On Sep 3, 2010, at 9:08 AM, syrvn wrote:
Hi,
the R code:
a <-
matrix
(c(1,5,4,3,7,10,34,4,3,8,6,5,12,17,45,3,2,45,46,47,3,4,22,12,21),
nrow=5)
rownames(a) <- c("a","b","c","d","e")
a
a[which(a[,3] < 8), ]
a[which(a[,3] < 6), ]
It wasn't exactly clear and possible that you wanted only r
Hi!
I don't really understand your goal, but if you want to extract the row
names,
rownames(a[which(a[,3] < 8), ])
does it.
But I think you've already tried it. Maybe it's just me...
HTH
Ivan
Le 9/3/2010 15:08, syrvn a écrit :
> Hi,
>
> the R code:
>
> a<- matrix(c(1,5,4,3,7,10,34,4,3,8,6,5,
R doesn't simply treat a row vector as a matrix.
--
View this message in context:
http://r.789695.n4.nabble.com/how-to-get-row-name-of-matrix-when-result-is-a-vector-tp2525631p2525666.html
Sent from the R help mailing list archive at Nabble.com.
__
R-
Hi,
I do not understand the code right now but it does its job.
Thanks a lot!
Best,
syrvn
--
View this message in context:
http://r.789695.n4.nabble.com/how-to-get-row-name-of-matrix-when-result-is-a-vector-tp2525631p2525657.html
Sent from the R help mailing list archive at Nabble.com.
__
Try this:
a[a[,3] < 6,, drop = FALSE]
On Fri, Sep 3, 2010 at 10:08 AM, syrvn wrote:
>
> Hi,
>
> the R code:
>
> a <-
> matrix(c(1,5,4,3,7,10,34,4,3,8,6,5,12,17,45,3,2,45,46,47,3,4,22,12,21),
> nrow=5)
> rownames(a) <- c("a","b","c","d","e")
> a
> a[which(a[,3] < 8), ]
> a[which(a[,3] < 6), ]
>
5 matches
Mail list logo