Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Benjamin Gillespie
to count unique values from two linked matricies HI Ben, Sorry,I couldn't understand how you counted the trait richness. Could you elaborate? A.K. - Original Message - From: benrgillespie gy...@leeds.ac.uk To: r-help@r-project.org Cc: Sent: Monday, September 24, 2012 7:47 AM Subject: [R

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Heramb Gadgil
http://www.geog.leeds.ac.uk/ From: arun [smartpink...@yahoo.com] Sent: 24 September 2012 19:36 To: Benjamin Gillespie Subject: Re: [R] Script to count unique values from two linked matricies HI Ben, Sorry,I couldn't understand how you counted the trait

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread PIKAL Petr
Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Benjamin Gillespie Sent: Tuesday, September 25, 2012 10:11 AM To: arun; r-help@r-project.org Subject: Re: [R] Script to count unique values from two linked matricies Hi, Thanks for helping

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Rui Barradas
To: Benjamin Gillespie Subject: Re: [R] Script to count unique values from two linked matricies HI Ben, Sorry,I couldn't understand how you counted the trait richness. Could you elaborate? A.K. - Original Message - From: benrgillespie gy...@leeds.ac.uk To: r-help@r-project.org Cc: Sent

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Benjamin Gillespie
: +44(0)770 868 7641 http://www.geog.leeds.ac.uk/ From: arun [smartpink...@yahoo.commailto:smartpink...@yahoo.com] Sent: 24 September 2012 19:36 To: Benjamin Gillespie Subject: Re: [R] Script to count unique values from two linked matricies HI Ben, Sorry,I

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Benjamin Gillespie
14:22 To: Benjamin Gillespie Cc: PIKAL Petr; Rui Barradas; Heramb Gadgil; R help Subject: Re: [R] Script to count unique values from two linked matricies Hi Ben, Just a modification of Petr's solution with library(data.table): dat1-data.frame(Species=paste0(Species,1:3),Site1=c(5,NA,4),Site2=c

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Rui Barradas
/ From: Rui Barradas [ruipbarra...@sapo.pt] Sent: 25 September 2012 10:30 To: Benjamin Gillespie Cc: arun; r-help@r-project.org Subject: Re: [R] Script to count unique values from two linked matricies Hello, Try the following. countTrait - function(x) length( unique(x[x != 0

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread arun
heramb.gad...@gmail.com Cc: arun smartpink...@yahoo.com; r-help@r-project.org r-help@r-project.org Sent: Tuesday, September 25, 2012 8:56 AM Subject: RE: [R] Script to count unique values from two linked matricies Fantastic help - thanks guys. Heramb, Pikal and Rui all came up with solutions. I prefer

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Benjamin Gillespie
2012 17:04 To: Benjamin Gillespie Cc: R help Subject: Re: [R] Script to count unique values from two linked matricies Hi Ben, No problem. The code could be collapsed to 2 steps: library(data.table) library(reshape) datm-merge(melt(dat1),melt(dat2),by=Species) dat3-data.frame(unlist(lapply(lapply

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread arun
...@precheza.cz; Rui Barradas ruipbarra...@sapo.pt; Heramb Gadgil heramb.gad...@gmail.com; R help r-help@r-project.org Sent: Tuesday, September 25, 2012 9:34 AM Subject: RE: [R] Script to count unique values from two linked matricies Excellent - thanks so much. Ben Gillespie Research Postgraduate

Re: [R] Script to count unique values from two linked matricies

2012-09-24 Thread benrgillespie
Note, trait richness would be 5 and not 4 at site 1 perfectly demonstrating why I want to create a script rather than manually count! -- View this message in context: http://r.789695.n4.nabble.com/Script-to-count-unique-values-from-two-linked-matricies-tp4643979p4643980.html Sent from

Re: [R] Script to count unique values from two linked matricies

2012-09-24 Thread Benjamin Gillespie
: PIKAL Petr [petr.pi...@precheza.cz] Sent: 24 September 2012 13:34 To: Benjamin Gillespie; r-help@r-project.org Subject: RE: [R] Script to count unique values from two linked matricies Hi I have no access to Nabble so it is difficult to understand what do you want. -Original Message

[R] Script to count unique values from two linked matricies

2012-09-24 Thread benrgillespie
I hope you can help with this one. I have two matricies: 1. A species abundance matrix: http://r.789695.n4.nabble.com/file/n4643979/2species_matrix.jpg 2. A species trait score matrix: http://r.789695.n4.nabble.com/file/n4643979/2trait_matrix.jpg The trait matrix lists trait scores for

Re: [R] Script to count unique values from two linked matricies

2012-09-24 Thread PIKAL Petr
] Script to count unique values from two linked matricies I hope you can help with this one. I have two matricies: 1. A species abundance matrix: http://r.789695.n4.nabble.com/file/n4643979/2species_matrix.jpg 2. A species trait score matrix: http://r.789695.n4.nabble.com/file/n4643979

Re: [R] Script to count unique values from two linked matricies

2012-09-24 Thread benrgillespie
Richness should look like this: http://r.789695.n4.nabble.com/file/n4644004/trait_richness.jpg -- View this message in context: http://r.789695.n4.nabble.com/Script-to-count-unique-values-from-two-linked-matricies-tp4643979p4644004.html Sent from the R help mailing list archive at