[R] correlating rows of two differently-sized data frames in R

R. Michael Weylandt michael.weylandt at gmail.com
Thu Aug 9 18:28:29 CEST 2012


Perhaps load them both and ?merge can show you the way.

Michael

On Thu, Aug 9, 2012 at 9:54 AM, JenniferH <jenachobbs at gmail.com> wrote:
> Hello everyone,
>
> I have two sets of data, with the following structure:
>
> DataSet1
> Location   Part    Sample 1   Sample 2
> A                     1           value         value
> A                     2           value         value
> A                     3           value         value
> B                     1           value         value
>
> DataSet2
> Location   Sample 1    Sample 2
> A                      value          value
> B                      value          value
> C                      value          value
>
> I would like to look at the correlations between DataSet1 and DataSet2, such
> that each row in Location A from DataSet1 is paired with the Location A row
> from DataSet2, and so forth.  So far, my only ideas  involve trying to
> copy-paste each of the rows in DataSet2 the number of times each occurs in
> DataSet1 on a spreadsheet before loading the sets into R; however, as I have
> approaching 8000 rows in DataSet2, this is clearly not a workable solution!
>
> I'm sure there's a simple solution to this, so I'm sorry if this seems like
> a really silly question.
>
> Thanks for your help!
>
> Jen
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/correlating-rows-of-two-differently-sized-data-frames-in-R-tp4639774.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list