How to find which file is responsible for "Can t recycle x to match place"

892 Views Asked by At

I encountered the following error while performing the loop function in order to import my data into R

Error in vctrs::data_frame(): ! Can't recycle users (size 117) to match places (size 3)

The code I used is as follows:

filesU <- list.files("C:/Users/artde/OneDrive/Documents/Master R/Master R/Project 1/Json/Daran_API_U/")

tweetsU = fromJSON("C:/Users/artde/OneDrive/Documents/Master R/Master R/Project 1/Json/Daran_API_U/users_1344795476151971842.json", flatten=T)

filesU <- filesU[-1] 

for (file in 1:length(filesU)) { 
    tweetsU_loop = fromJSON(paste0("C:/Users/artde/OneDrive/Documents/Master R/Master R/Project 1/Json/Daran_API_U/", 
                                   filesU[file])) 
    tweetsU = bind_rows(tweetsU,tweetsU_loop) 
}

However I keep getting this error after performing the bind part

Error in vctrs::data_frame(): ! Can't recycle users (size 117) to match places (size 3). Run rlang::last_error() to see where the error occurred.

With another data set this has worked perfectly so far, however in this dataset it seems that there is a file that creates a problem and does not allow the loop and bind function to work I understand that is due to one of these files having a different length or value compared to the other files, but considering i have 640 files, i was wondering if there was a way to pinpoint the responsible one (there is no obvious one, which has a very different name or is way heavier than every other)

All the files are in Json

0

There are 0 best solutions below