Is this what you are looking for:
> mdat3
sp.1 sp.2 sp.3 sp.4 sp.5
T110010
T210010
T311100
T410111
>
> # create a matrix of when species first appeared
> first <- apply(mdat3, 2, function(x) (cumsum(x == 1) > 0) + 0
On Wed, May 18, 2011 at 9:49 PM, jim holtman wrote:
> Is this what you were after:
>
>> mdat <- matrix(c(1,0,1,1,1,0), nrow = 2, ncol=3, byrow=TRUE,
> + dimnames = list(c("T1", "T2"),
> + c("sp.1", "sp.2", "sp.3")))
>>
>> mdat
> sp.1 sp.2 sp.3
> T1
Is this what you were after:
> mdat <- matrix(c(1,0,1,1,1,0), nrow = 2, ncol=3, byrow=TRUE,
+ dimnames = list(c("T1", "T2"),
+ c("sp.1", "sp.2", "sp.3")))
>
> mdat
sp.1 sp.2 sp.3
T1101
T2110
> # do 'rle' on each column and see
On Sun, Feb 20, 2011 at 2:56 PM, Dmitry Berman wrote:
> On Sun, Feb 20, 2011 at 5:55 PM, Dmitry Berman wrote:
>
>> Listers,
>>
>> I have a simple matrix:
>>
>> --
>> m <-c(1:7)
>> m <- cbind(m)
>>
>> m
>> [1,] 1
>> [2,] 2
>> [3,] 3
>> [4,] 4
>> [5,] 5
>> [6,] 6
>>
On Feb 20, 2011, at 5:56 PM, Dmitry Berman wrote:
On Sun, Feb 20, 2011 at 5:55 PM, Dmitry Berman
wrote:
Listers,
I have a simple matrix:
--
m <-c(1:7)
m <- cbind(m)
m
[1,] 1
[2,] 2
[3,] 3
[4,] 4
[5,] 5
[6,] 6
[7,] 7
---
I
On Sun, Feb 20, 2011 at 5:55 PM, Dmitry Berman wrote:
> Listers,
>
> I have a simple matrix:
>
> --
> m <-c(1:7)
> m <- cbind(m)
>
> m
> [1,] 1
> [2,] 2
> [3,] 3
> [4,] 4
> [5,] 5
> [6,] 6
> [7,] 7
> ---
>
> I want to add a second co
I think you want ?solve ...
Remko
--
View this message in context:
http://r.789695.n4.nabble.com/matrix-help-tp2714378p2714896.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/ma
7 matches
Mail list logo