Dear r-users! I would like to cross two data frame which have the same row number but different in the number of column. Can anybody help me for this case ? Thanks a lot in advance -------------------------------------------------------------------------------- Majid Iravani PhD Student Swiss Federal Research Institute WSL Research Group of Vegetation Ecology Z?rcherstrasse 111 CH-8903 Birmensdorf Switzerland Phone: +41-1-739-2693 Fax: +41-1-739-2215 Email: Majid.iravani at wsl.ch http://www.wsl.ch/staff/majid.iravani/
Hi try to: 1. read posting.guide 2. look into some introduction documents and FAQs 3. consult help 4. look to ?merge, ?cbind, ?rbind HTH Petr On 12 Oct 2006 at 14:45, Majid Iravani wrote: Date sent: Thu, 12 Oct 2006 14:45:19 +0200 To: r-help at stat.math.ethz.ch From: Majid Iravani <majid.iravani at wsl.ch> Subject: [R] Cross two dataframe> > Dear r-users! > > I would like to cross two data frame which have the same row number > but different in the number of column. Can anybody help me for this > case ? > > Thanks a lot in advance > > ---------------------------------------------------------------------- > ---------- > Majid Iravani > PhD Student > Swiss Federal Research Institute WSL > Research Group of Vegetation Ecology > Z?rcherstrasse 111 CH-8903 Birmensdorf Switzerland > Phone: +41-1-739-2693 > Fax: +41-1-739-2215 > Email: Majid.iravani at wsl.ch > http://www.wsl.ch/staff/majid.iravani/ > > ______________________________________________ > 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 Pikal petr.pikal at precheza.cz
I am unsure what you need, but try ?merge. If this isn't what you need, try posting an example. hth, Mihai Nica 170 East Griffith St. G5 Jackson, MS 39201 601-914-0361 ----- Original Message ---- From: Majid Iravani <majid.iravani@wsl.ch> To: r-help@stat.math.ethz.ch Sent: Thursday, October 12, 2006 7:45:19 AM Subject: [R] Cross two dataframe Dear r-users! I would like to cross two data frame which have the same row number but different in the number of column. Can anybody help me for this case ? Thanks a lot in advance -------------------------------------------------------------------------------- Majid Iravani PhD Student Swiss Federal Research Institute WSL Research Group of Vegetation Ecology Zürcherstrasse 111 CH-8903 Birmensdorf Switzerland Phone: +41-1-739-2693 Fax: +41-1-739-2215 Email: Majid.iravani@wsl.ch http://www.wsl.ch/staff/majid.iravani/ ______________________________________________ R-help@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. [[alternative HTML version deleted]]
Actually, I'm a beginner too :-) It's just this list is so helpful, and I was helped so many times, that I am trying to bring my small contribution :-) How about: #_____________________________________________ Y1=X*Y[,1] Y=cbind(Y,Y1) Y site1 site2 site3 site4 site5 site6 site7 stage1 stage2 stage3 A 1 5 9 13 17 21 25 1 5 9 B 2 6 10 14 18 22 26 4 12 20 C 3 7 11 15 19 23 27 9 21 33 D 4 8 12 16 20 24 28 16 32 48 #_______________________________________________ And then change the names as you like... I bet there is a more elegant way, but it seems to work :-) hth, Mihai Nica 170 East Griffith St. G5 Jackson, MS 39201 601-914-0361 ----- Original Message ---- From: Majid Iravani <majid.iravani@wsl.ch> To: Mihai Nica <mihainica@yahoo.com> Sent: Friday, October 13, 2006 1:58:29 AM Subject: Re: [R] Cross two dataframe Dear Mihai Nica Thanks. Actually I dont want to merge two data frames. For example if I have two matrixes X and Yas follow: X<- matrix(1:12, nrow=4, ncol=3, dimnames=list(c("A","B","C","D"), c("stage1","stage2","stage3"))) Y<- matrix(1:28, nrow=4, ncol=7, dimnames=list(c("A","B","C","D"), c("site1","site2","site3","site4","site5", "site6","site7"))) I would like to multiply first column of the Ymatrix (site1) to the all of the columns in Xmatrix. Then, the product will be three new columns (site1stage1, site1stage2 and site1stage3) which I want to add to Ymatrix. As my site (Y) dataset has about 400 columns its not easy to do it in Excel and Im looking for a command in R to prepare a new data frame for more analysis. So I would greatly appreciate if you help me in this case. Thanks a lot again Majid At 10:06 AM 10/12/2006 -0700, you wrote:>Mihai Nica-------------------------------------------------------------------------------- Majid Iravani PhD Student Swiss Federal Research Institute WSL Research Group of Vegetation Ecology Zürcherstrasse 111 CH-8903 Birmensdorf Switzerland Phone: +41-1-739-2693 Fax: +41-1-739-2215 Email: Majid.iravani@wsl.ch http://www.wsl.ch/staff/majid.iravani/ -------------------------------------------------------------------------------- [[alternative HTML version deleted]]
Apparently Analagous Threads
- multiply two matrixes with the different dimension column by column
- How can I calculate conditional mean in a large dataset including date data
- paired repeated measurements
- random sampling with some limitive conditions?
- converting NA/non-NA's to a binary variable