---
title: "R Notebook"
output: html_notebook
---
```{r}
wiki <- readr::read_csv(here::here("data-raw/result.csv"))
geo <- wiki |>
janitor::clean_names() |>
select(geolocation) |>
filter(!is.na(geolocation))
```
## Prepare
```{r}
dms_to_decimal <- function(input) {
sp::char2dms(input, chd="d", chm="m", chs="s") |> as.numeric()
}
geo <- geo |>
head(10) |>
mutate(geolocation = toupper(geolocation),
geolocation = str_replace_all(geolocation, '°', "d"),
geolocation = str_replace_all(geolocation, "'", "m"),
geolocation = str_replace_all(geolocation, '"', "s")) |>
mutate(geo_split = stringr::str_split(geolocation, ",")) |>
rowwise() |>
mutate(lat = dms_to_decimal(geo_split[1]),
long = dms_to_decimal(geo_split[2]))
```