json - Proces files fast in loop with function in R -
i have read 88 thousand json files , process them. r-script looks this: webshop_id = numeric() serving = data.frame(value = numeric(), unit = character()) alcohol = data.frame(alcoholpercentage = numeric()) voeding = data.frame(character()) filenames <- list.files("d:/thijs/documents/ah/productfeatures/allproducts", pattern="*.json", full.names=true) tic() (i in 1:length(filenames)) { df = fromjson(filenames[i]) webshop_id = c(webshop_id, df$product$webshopid) if (is.null(df$productlabels$alcoholpercentage)==true){ alcohol = rbind(alcohol, alcoholpercentage = na) } else{ alcohol = suppresswarnings(rbind(alcohol, alcoholpercentage = as.numeric(gsub("%","",df$productlabels$alcoholpercentage)))) }if (length(df$productlabels$nutrition$nutritionvalues[[1]])==0){ temp_row = data.frame(matrix(c(rep.int(na,length(voeding))),nrow=1,ncol=length(voeding))) colnames(temp_row) = colnames(voeding)