R: Loop outputting only the last iteration
问题 I have 39 json files stored in a folder. They all have three columns in common: MOVEMENT_ID , DISPLAY_NAME and geometry . I would like to arrive at a dataset containing the data from all files, organised into these columns. I am using a for loop to do so. path = "~/geoboundaries" #path to the folder where the files are stored file.names=as.list(dir(path, pattern='.json', full.names=T)) #make a list of all file names out.file=st_sf(MOVEMENT_ID=factor(), DISPLAY_NAME=factor(), geometry=st_sfc()