David Winsemius
On Feb 9, 2009, at 9:46 AM, Ian Fiske wrote:
>
> If your matrix is called mat, how about
>
> mat[which(mat[,2] > 0), ]
>
>
> mat[which(mat[,2] < 0), ]
>
>
> -Ian
>
>
> mentor_ wrote:
>>
>> Hi,
>>
>> I have a matrix with negative and positiv values.
>> How can I get either the negative or positive values from the matrix?
>>
>> Matrix:
>> [,1] [,2]
>> [1,] 1 -3
>> [2,] 2 -2
>> [3,] 3 5
>> [4,] 4 -2
>> [5,] 5 9
>> [6,] 6 8
>> [7,] 7 -2
>>
>> What I want to have is:
>>
>> [,1] [,2]
>> [1,] 1 -3
>> [2,] 2 -2
>> [3,] 4 -2
>> [4,] 7 -2
>>
>> and:
>>
>> [,1] [,2]
>> [1,] 3 5
>> [2,] 5 9
>> [3,] 6 8
>>
>>
>> Regards
>>
>
> --
> View this message in context: http://www.nabble.com/Return-values-%3C-0-from-Matrix-tp21913440p21914262.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.