JosiahParry / sfdep

A tidy interface for spatial dependence
https://sfdep.josiahparry.com/
GNU General Public License v3.0
121 stars 5 forks source link

significance on local moran #26

Closed lsempe77 closed 2 years ago

lsempe77 commented 2 years ago

Hi Josiah,

Great work on this package! Very keen to use and collaborate here!

Just a quick suggestion on the local_moran example. I would suggest not plotting non-significant results (as highlighted in bold, although it is not very elegant!

lisa %>% tidyr::unnest(moran) %>% mutate (mean = case_when(p_ii>.05 | is.nan(p_ii) ~ NAcharacter, T ~ as.character(mean))) %>% ggplot(aes(fill = mean)) + geom_sf() + geom_sf(lwd = 0.2, color = "black") + theme_void() + scale_fill_manual(values = c("#1C4769", "#24975E", "#EACA97", "#B20016"))

JosiahParry commented 2 years ago

Thanks! I've updated the readme.

Note that since you only have one condition, you can use an ifelse() here.