Alguns erros são:
Olha a linha link[j,2]
tem dois ))
remova 1 deles...
vc criou um dataframe chamado links
mas depois está tentando alimentar o link
(sem o "s"), ou seja existe bastante erros de sintaxe...
Aparentemente você está querendo alimentar o dataframe links
com a URL do aeroporto certo? se for isso não precisa criar dois fors
, crie uma variável auxiliar que incremente a cada iteração um j
por exemplo, o código funcional ficaria assim:
aeroportos <- c("bsb",
"cgh",
"gru",
"vcp",
"sdu",
"gig",
"poa",
"cwb",
"cnf",
"bel",
"ssa",
"rec",
"for",
"slz",
"cgr")
links <- data.frame(aeroporto = aeroportos, link = NA)
j=1;
for(i in aeroportos) {
links[j,2] <- paste0("https://www.flightradar24.com/data/airports/", i,"/statistics")
j=j+1;
}
print(links)
resultado do print(links)
:
aeroporto link
1 bsb https://www.flightradar24.com/data/airports/bsb/statistics
2 cgh https://www.flightradar24.com/data/airports/cgh/statistics
3 gru https://www.flightradar24.com/data/airports/gru/statistics
4 vcp https://www.flightradar24.com/data/airports/vcp/statistics
5 sdu https://www.flightradar24.com/data/airports/sdu/statistics
6 gig https://www.flightradar24.com/data/airports/gig/statistics
7 poa https://www.flightradar24.com/data/airports/poa/statistics
8 cwb https://www.flightradar24.com/data/airports/cwb/statistics
9 cnf https://www.flightradar24.com/data/airports/cnf/statistics
10 bel https://www.flightradar24.com/data/airports/bel/statistics
11 ssa https://www.flightradar24.com/data/airports/ssa/statistics
12 rec https://www.flightradar24.com/data/airports/rec/statistics
13 for https://www.flightradar24.com/data/airports/for/statistics
14 slz https://www.flightradar24.com/data/airports/slz/statistics
15 cgr https://www.flightradar24.com/data/airports/cgr/statistics