Re: [R] Problem with binding data-frames

From: Petr Klasterecky <klaster_at_karlin.mff.cuni.cz>
Date: Mon, 18 Jun 2007 12:55:41 +0200

Junnila, Jouni napsal(a):
> Hello,
>
> I'm having a problem concerning r-binding datasets.
>
> I have six datasets, from six different plates, and two different days.
> I want to combine these datasets together for analysis. Datasets from

> day 2, have all the same columns than datasets from day 1. However in
> addition, there are few columns more in day 2. Thus, using rbind for
> this, results a error, because the objects are not the same length.
>
> Error in paste(nmi[nii == 0L], collapse = ", ") :
> object "nii" not found
> In addition: Warning message:
> longer object length
> is not a multiple of shorter object length in: clabs == nmi

Hi,

  1. the error has nothing to do with differing lengths of your objects - that's what the following warning is about. The error occured because your indexing object 'nii' does not exist where R is looking for it.
  2. using rbind on dataframes is a bad practice, since the input is converted to marices if possible. Use merge() instead.

Petr

>
>
> What I need, is to combine all the six together, and give for example
> NA-value in day 1, for those columns which can only be found in day 2.
> Is this somehow possible?
>
> I have several of these six-datasets groups, and only few of them are
> having this problem described above, and I cannot know in advance which.
> With most of the groups writing
> rbind(data1,data2,data3,data4,data5,data6)
> works easily, but these few problematic groups need also to be
> combined...
> Any help greatly appreciated!
>
> -Jouni
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch 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.
>

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

______________________________________________
R-help_at_stat.math.ethz.ch 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.
Received on Mon 18 Jun 2007 - 11:08:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 18 Jun 2007 - 12:32:03 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.