library(tidyverse)
library(leaflet)
<-c(59.342549793703554, 18.057070698337594)
line=tibble(line) %>%
dft()
colnames(df)<-c("lat","long")
= df %>% as.data.frame() %>% tibble()
df =df %>% mutate(class = c(1))
df
<- function(df) {
getColor sapply(df$class, function(class) {
if(class == 1) {
"green"
else if(class == 2) {
} "orange"
else {
} "red"
} })
}
<- awesomeIcons(
icons icon = 'ios-close',
iconColor = 'black',
library = 'ion',
markerColor = getColor(df)
)
#install.packages("leaflet")
#df
leaflet(data = df) %>% addTiles() %>%
addAwesomeMarkers(~long, ~lat,icon=icons, label=~as.character(class))
Creating maps in R
news
code
analysis
Here we will dive deeper into the maps
Stockholm is the place to be
Creating a map
Leaflet is the package for you!