如何在不使用for循环的情况下迭代列的值?

时间:2019-07-25 21:06:06

标签: r

使用此命令:

library(rgeolocate)
file <- system.file("extdata","GeoLite2-Country.mmdb", package = "rgeolocate")
results <- maxmind(c("94.69.228.169","54.36.149.33"), file, c("country_code", "country_name"))

如何通过和迭代来更改c("94.69.228.169","54.36.149.33"),但不需要for循环?

假设这是一个数据框

df <- data.frame(id = c("94.69.228.169","54.36.149.33"))

并想要使用类似这样的东西

results <- maxmind(for(i in nrow(df)){df$id[i]}, file, c("country_code", "country_name"))

0 个答案:

没有答案