Skip to content
Prev 4318 / 7420 Next

[Fwd: Re: how to detect different species among samples]

Hi Gian,

in your code, you selected column and do logic test when what you want 
is to do test in line

In dune data, sites are lines, then:

# Select species with abundance > 0 on line 1
spp1 <- names(dune[1, dune[1, ] > 0])

# Select species with abundance > 0 on line 2
spp2 <- names(dune[2, dune[2, ] > 0])

# Common species
spp1[spp1 %in% spp2]

# Different species
spp1[!spp1 %in% spp2]

Matrix and data frames can be referenced, for example:

dune[line, column]

If you want all column of line 1:

dune[line, ] # must have ","

If you want some column (or lines), logic test return a vector of 
TRUE/FALSE and you put this in column (or line) place. This return only 
column where vector have TRUE. Then you want invert results of vector 
TRUE/FALSE using "!"

v <- c(TRUE, FALSE, TRUE)

v
TRUE, FALSE, TRUE

!v
FALSE, TRUE, FALSE

Excuse me if I do not understand your question.

Best regards,

Mario

...................................................
Mario Jos? Marques
Doctoral student in Ecology
Institute of Biology, Dept. Plant Biology, Ecology Lab.
State University of Campinas - UNICAMP
Campinas, S?o Paulo, Brazil
On 07-02-2014 09:30, Gian Maria Niccol? Benucci wrote: