Thanks Dennis,
Your code also produces same as Jim's but I am not looking that one, I need
to use "cbind" so that finally I will get the data frame of size 200X320
(i,e, 200 X(16X20)).
Thanks


On Tue, Dec 4, 2012 at 10:46 PM, Dennis Murphy <djmu...@gmail.com> wrote:

> In addition to Jim's reply, had you used the plyr package, you could
> have done this in one shot:
>
> library(plyr)
>
> DF <- ldply(llply(temp, read.table), rbind)
>
> The inner llply call is equivalent to your lapply() and the outer
> ldply() is equivalent to Jim's do.call() code.
>
> Dennis
>
> On Tue, Dec 4, 2012 at 6:37 PM, Gyanendra Pokharel
> <gyanendra.pokha...@gmail.com> wrote:
> > Hi group,
> >
> > I imported  16 data frames using the function "list.files"
> >
> > temp <- list.files(path="...........")
> > myfiles = lapply(temp, read.table,sep = "")
> >
> > Now I have 16 data set imported in R window.
> >
> > I want to combine them by row and tried some thing like (Here I am
> > considering only 20 columns)
> >
> > for(i in 1:16){
> >     data<- cbind(myfiles[[i]][,1:20])
> >
> > }
> >
> >
> > but it returns only first data set. I can combine them using
> >
> > data <- cbind(myfiles[[1]][,1:20],myfiles[[2]][1:20],...............)
> >
> > But  I want in a loop so that I can make the efficient code.
> >
> > Any kind of suggestion will be great for me.
> >
> > Thanks
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to