Есть ли лучший способ преобразовать огромный список (более 100 тыс.) В фрейм данных.
for (i in 1:length(google_20180623_list)) {
if (google_20180623_list[[i]]$status != "OK") next
name <- google_20180623_list[[i]]$result$name
formatted_address <- google_20180623_list[[i]]$result$formatted_address
place_id <- google_20180623_list[[i]]$result$place_id
geom <- data.frame(google_20180623_list[[i]]$result$geometry$location)
types <- google_20180623_list[[i]]$result$types
types <- paste(types, collapse = "/")
oa <- google_20180623_list[[i]]$result$opening_hours$weekday_text
if (is.null(oa)){
oa <- NA
} else {
oa <- as.data.frame(oa)
oa <- oa %>% separate(oa,into=c("days", "opening"), sep=": ", remove=T)
oa <- oa %>% spread(key = "days", value = "opening")
}
rating <- google_20180623_list[[i]]$result$rating
if (is.null(rating)) {rating<-NA}
price_level <- google_20180623_list[[i]]$result$price_level
if (is.null(price_level)) {price_level<-NA}
phone <- google_20180623_list[[i]]$result$international_phone_number
if (is.null(phone)) {phone<-NA}
website <- google_20180623_list[[i]]$result$website
if (is.null(website)) {website<-NA}
cb<-cbind(place_id
,name
,formatted_address
,geom
,phone
,website
,rating
,price_level
,oa
,types
)
google_20180623_list_unlist<-rbindlist(list(google_20180623_list_unlist,cb),fill = T)
}
Этот код невероятно медленный, он занимает более 24 часов. Любая идея?
Данные взяты из Google Подробная информация о месте API.
Спасибо за помощь.