I would like to extract the latitude and longitude information of five stadiums in Dallas. Each of these five stadiums is listed in a column named "Venue", and is presented in a hyperlink form from a Wikipedia table on the following website: https://en.wikipedia.org/wiki/Sports_in_Dallas.
My goal is to write some code which allows me to go inside each hyperkink and open another hyperlink via the information in "Coordinates" to get the latitude and longitude in decimal form.
I need a new column called "latitude" and another one called "longitude" in my "data" table.
I am trying to loop it but do not have a clue on how to get it.
Please, I need your help.
library(rvest)
library(dplyr)
url = "https://en.wikipedia.org/wiki/Sports_in_Dallas"
data <- read_html(url) %>%
html_element(".wikitable")%>%
html_table()%>%
select(Team, Sport, Venue)
for(i in 1:nrow(data)){
data$latitude <-
data$longitude <-
}