I am trying to convert my data so that it can be plotting on a map. For example the data looks like:
# A tibble: 2 x 2
Latitud Longitud
<chr> <chr>
1 10º 35' 28.98'' N 3º 41' 33.91'' O
2 10º 35' 12.63'' N 3º 45' 46.22'' O
I am trying to mutate it using the following:
df %>%
mutate(
Latitud = str_replace_all(Latitud, "''", ""),
lat_edit = sp::char2dms(Latitud), "°")
Which returns and error:
Error in if (any(abs(object@deg) > 90)) return("abs(degree) > 90") :
missing value where TRUE/FALSE needed
In addition: Warning message:
In asMethod(object) : NAs introduced by coercion
I would like to plot these two points on a map in ggplot (or another spatial package)
Data:
structure(list(Latitud = c("40º 25' 25.98'' N", "40º 25' 17.63'' N"
), Longitud = c("3º 42' 43.91'' O", "3º 40' 56.22'' O")), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -2L))