I have a large dataset with 9,000 entries. I hope to split it into subfiles and name them as 1-1000, 1001 - 2000 etc.
d <- split(df,rep(1:9,each=1000))
lapply(names(d),
function(x){
start <- x*1000-1000 + 1
end <- x*1000
write.csv(d[[x]], file = paste0("directory_name/", start, "-", "end",".csv"),
row.names = FALSE)})
Using the code above, I get an error saying "Error: unexpected '}' in file = paste0("directory_name/", start, "-", end,".csv"), row.names = FALSE)". I am not sure how to solve this, could anyone help me? Thank you.