if(interactive()){
if (requireNamespace("maps", quietly = TRUE)) {
canada <- maps::map("world", "Canada",
fill=TRUE, plot=FALSE)
p <- l_plot()
l_map <- l_layer(p, canada,
asSingleLayer=TRUE, color = "cornsilk")
l_map['color'] <- ifelse(grepl("lake", canada$names, TRUE),
"lightblue", "cornsilk")
l_scaleto_layer(p, l_map)
l_map['active'] <- FALSE
l_map['active'] <- TRUE
l_map['tag']
}
}
Run the code above in your browser using DataLab