rownames(X)[apply(X, 1, function(r) any(r < 0))]
... if I understand you correctly.
________________________________________
From: [email protected] [[email protected]] On Behalf Of
Manisha Brahmachary [[email protected]]
Sent: 07 June 2009 08:54
To: [email protected]
Subject: [R] extract rows having negative values
Hello,
I have a matrix with 6 columns and 12 rows. I want to extract out those IDs
(rownames) from my matrix which have a negative values. For each ID(row) if
the negative value is even under 1 column it needs to be extracted out. I
will be grateful for any correct suggestion.
Thanks
Manisha
Here is the matrix that I am working on:
ID
A
B
C
D
E
F
1
-4.18972
-3.8946
-1.14888
-1.88406
-8.34124
10.97497
2
11.81028
11.1054
0.85112
0.115942
-4.34124
24.97497
3
-0.18972
-1.8946
1.85112
-4.88406
-17.3412
-13.025
4
-1.18972
3.105402
-0.14888
-12.8841
-15.3412
4.974967
6
-3.18972
4.105402
24.85112
0.115942
1.658762
-11.025
7
-2.18972
-10.8946
-20.1489
-1.88406
3.658762
-11.025
8
-0.18972
-7.8946
-7.14888
-9.88406
3.658762
-9.02503
9
-5.18972
-4.8946
-12.1489
0.115942
-12.3412
10.97497
10
17.81028
9.105402
-15.1489
10.11594
19.65876
9.974967
11
538.8103
335.1054
863.8511
229.1159
520.6588
143.975
12
30.81028
18.1054
30.85112
16.11594
9.658762
13.97497
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.
______________________________________________
[email protected] 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.