airprobread <- function(id) {
fi <- list()
for (i in id) {
if(i < 10) {
fi[[i]] <- read.csv(file = paste("00",i,".csv",sep=""))
} else
if((i >= 10) & (i < 100)) {
fi[[i]] <- read.csv(file=paste("0",i,".csv",sep=""))
} else
if (i >= 100) {
fi[[i]] <- read.csv(file=paste(i,".csv",sep=""))
}
}
for (j in id) {
print(fi[[j]])
}
}
I am unable to understand why the concatenation is not happening in the case of
paste()
functionFiles from
001.csv
to009.csv
and010.csv
to099.csv
not opening. Gives comments like:In file(file, "rt") : cannot open file '2.csv': No such file or directory
In file(file, "rt") : cannot open file '34.csv': No such file or directory
but it works for values above
100.csv
(file opens for315.csv
)
I'm here so pardon me for the formatting.