Fwd: Highlight an area using symbol

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Highlight an area using symbol

raman
Raman Mishra
Senior Research Scholar
International Institute for Population Sciences, Mumbai
Mobile: +91-8879317106


---------- Forwarded message ---------
From: Raman Mishra <[hidden email]>
Date: Mon, Nov 18, 2019 at 12:19 PM
Subject: Highlight an area using symbol
To: <[hidden email]>


My data have a missing value for a district, I gave 0 value for the
district and did spatial analysis (Univariate, Regression etc.).

I tried using "NA" instead of 0 value for that district but most of the
codes available online are not working with "NA" and it won't be ethical to
delete that area from my map.

I want to highlight that district using symbols.

Is it possible that after the creation of maps one can highlight that
district using some function?

Please provide a solution as I am new to R.

Thanks
Raman Mishra
Senior Research Scholar
International Institute for Population Sciences, Mumbai
Mobile: +91-8879317106

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Highlight an area using symbol

Roger Bivand
Administrator
On Mon, 18 Nov 2019, Raman Mishra wrote:

> Raman Mishra
> Senior Research Scholar
> International Institute for Population Sciences, Mumbai
> Mobile: +91-8879317106
>
>
> ---------- Forwarded message ---------
> From: Raman Mishra <[hidden email]>
> Date: Mon, Nov 18, 2019 at 12:19 PM
> Subject: Highlight an area using symbol
> To: <[hidden email]>
>
>
> My data have a missing value for a district, I gave 0 value for the
> district and did spatial analysis (Univariate, Regression etc.).
>
> I tried using "NA" instead of 0 value for that district but most of the
> codes available online are not working with "NA" and it won't be ethical to
> delete that area from my map.
>
> I want to highlight that district using symbols.
>
> Is it possible that after the creation of maps one can highlight that
> district using some function?
>
> Please provide a solution as I am new to R.

library(sf)
nc <- st_read(system.file("shape/nc.shp", package="sf"))
library(tmap)
tm_shape(nc) + tm_fill("SID74")
set.seed(1)
is.na(nc$SID74) <- sample(1:nrow(nc), 5)
tm_shape(nc) + tm_fill("SID74")

tm_fill() denotes NA values automatically, and provides the easiest
solution. You could also add a symbol, but I don't think this is
necessary. tmap handles the older sp objects too, but new vector data work
should use sf, not sp.

Hope this helps,

Roger

>
> Thanks
> Raman Mishra
> Senior Research Scholar
> International Institute for Population Sciences, Mumbai
> Mobile: +91-8879317106
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway