Need assistance in R, usinf a "for" loop to read in multiple .csv files and assign them names so that the files can then be worked on -


this question has answer here:

in r, making function requires reading in 1:n csv files, how name each file in "for" loop , save. have tried test[i] <- read.csv(paste0("0", "0", i, sep="") , "closure" error. have searched through stack overflow , found similar questions nothing looking for. using 1 "if" statement , 2 "else if" statements in "for" loop. there 3 different paste0 functions, paste0("0", "0", i, ".csv", sep = ""), paste0("0", i, ".csv" sep = ""), , paste0(i, ".csv", sep "")

i signed stack overflow today , new r. sorry if overlooked question , has been answered.

what looking name_test[1] <- 001.csv , on.

perhaps work (not tested):

test <- lapply(1:n, function(i) read.csv(paste(sprintf("%03d", i), "csv", sep="."))) 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -