Hi Lily,
I think below codes can work:
f<- list.files("D:/output/test/your folde
rname",full.names=TRUE,recursive=TRUE)
files<- grep(".csv", f)
files_merge<- data.frame()
for (i in 1:length(f[files])){
data<- read.csv(file=f[files][i],header=TRUE, sep=",")
files_merge<- rbind(files_merge,
Hello,
Maybe something like this.
fls <- list.files(pattern = "*.csv")
dat.list <- lapply(fls, read.csv)
dat <- do.call(rbind, dat.list)
Hope this helps,
Rui Barradas
Citando lily li :
> Hi R users,
>
> I'd like to ask that how to merge several datasets into one in R? I put
> these csv file
Lily Li wrote :
I think you are going to have to give us some more detail. What commands did
you execute? what are the names of the .csv files in your directory? Can you
read one of them as asingle read.csv?
> Hi R users,
>
> I'd like to ask that how to merge several datasets into one in R? I
Lily:
If you mean that you have several csv files in a directory/folder on
your computer and you are using lapply() to do something with them,
then you do not have a clue about how R works and you need to go
through some tutorials to learn. There are many good ones on the web.
Some recommendations
Hi R users,
I'd like to ask that how to merge several datasets into one in R? I put
these csv files in one folder, and use the lapply function, but it says
that cannot open file 'xx.csv'. These files have different names, but end
with .csv extension, and the files have the same header. Thanks for
5 matches
Mail list logo