Thanks again.

By the way, any idea why I get this error:

merged3 <-  merge_all(list_of_files , by = "Name")
Error in `[.data.frame`(df, , match(names(dfs[[1]]), names(df))) :
  undefined columns selected


> sessionInfo()
R version 2.14.2 (2012-02-29)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252
 LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
LC_TIME=English_Australia.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] reshape_0.8.4 plyr_1.7.1

loaded via a namespace (and not attached):
[1] tools_2.14.2


Cheers,
Chintanu

=============================================================================


On Wed, Apr 11, 2012 at 11:10 PM, R. Michael Weylandt <
michael.weyla...@gmail.com> wrote:

> Simply pass all = FALSE to merge_all
>
> merge_all(list_of_files, by = "Name", all = FALSE)
>
> Michael
>
> On Wed, Apr 11, 2012 at 1:09 AM, Chintanu <chint...@gmail.com> wrote:
> > Thanks to David and Michael
> >
> > Michael:
> >
> > That works, however with a glitch. Each of my 24 files has got two
> columns:
> > "Name", and "Rank/score".
> >
> > file_list <- list.files()
> > list_of_files <- lapply(file_list, read.csv) # Read in each file
> >
> > # I can see the 2-columns at this stage. However, the following line:
> >
> > merge_all(list_of_files, by = "Name")
> >
> > # produces some NAs for the 2nd column (except the beginning 1/3rd of the
> > columns which have values). Not sure about the reason - the original
> files
> > don't have  any NAs.
> >
> >
> > Further, I understand that it gives the union of (rows of) files based on
> > "Name". Is there a way to look for intersection, i.e., similar to using:
> > merge (.... ,by="Name", all=FALSE)  ?
> >
> >
> > David:  It came up with an error :
> >
> > do.call(merge, list_of_files, by="Name")
> >
> > Error in do.call(merge, list_of_files, by = "Name") :
> >   unused argument(s) (by = "Name")
> >
> > Cheers,
> > Chintanu
> >
> >
>

        [[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