I have .csv data with large number of row. is there any function to split that in to multiple .csv based on same row (example based on same "location" column)? thank you
I tried to split my one .csv data in to several .csv data
I have .csv data with large number of row. is there any function to split that in to multiple .csv based on same row (example based on same "location" column)? thank you
I tried to split my one .csv data in to several .csv data
You can use split
to split the data into a list of data frame, then lapply
to write them to new csvs, e.g.
data<-read.csv("filename.csv")
datalist<-split(data,data$location)
lapply(datalist, function(dat){
write.csv(dat,paste0("data",dat$location[1],".csv"))
})