使用此命令:
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"))