I have written a code in R where lat and long are read from two tables and plotted with different colors on a map.
Both tables are structured as follows:
(I checked all enterties and they are all correct)
But the enviroment look like this (this is maybe the reason for the error)
The code looks like this:
install.packages('readxl')
library(readxl)
data_a <- read_excel('C:/Users/Location_map.xlsx', sheet = 'Core_Tops')
data_b <- read_excel('C:/Users/Location_map.xlsx', sheet = 'Tows')
lat_a <- data_a$Lat
lon_a <- data_a$Long
lat_b <- data_b$Lat
lon_b <- data_b$Long
# until this point the code workes very well :D
install.packages('leaflet')
library(leaflet)
map <- leaflet() %>%
addTiles() %>%
addMarkers(lng = lon_a, lat = lat_a, icon = ~colorIcon("blue",iconSize = c(20, 20))) %>%
addMarkers(lng = lon_b, lat = lat_b, icon = ~colorIcon("red",iconSize = c(20, 20)))
map
When I execute it I get the following error message:
Error in UseMethod("metaData"): inapplicable method for 'metaData' applied to object of class "NULL"
What could be the cause? I can not find any answeres!