elp@r-project.org
Subject: Re: [R] Finding a vector position using names rather than values
Try this:
order(row_median)[names(row_median) == "R3"]
On Fri, Sep 12, 2008 at 5:22 AM, Jonsson, Pall < [EMAIL PROTECTED]> wrote:
Dear R gurus,
I have been struggling with this for a while
Try this:
order(row_median)[names(row_median) == "R3"]
On Fri, Sep 12, 2008 at 5:22 AM, Jonsson, Pall <[EMAIL PROTECTED]
> wrote:
> Dear R gurus,
>
> I have been struggling with this for a while and thought you might be able
> to give me some guidance.
>
> I have a data frame, on which I apply a
try this:
dframe <- data.frame(
Col1 = c(10,20,30),
Col2 = c(2,4,6),
Col3 = c(5,10,7),
row.names = c("R1","R2","R3")
)
mat <- data.matrix(dframe)
rowMedians <- apply(mat, 1, median)
rowMedians[names(rowMedians) %in% "R3"]
I hope it helps.
Best,
Dimitris
> Dear
Dear R gurus,
I have been struggling with this for a while and thought you might be able to
give me some guidance.
I have a data frame, on which I apply a row function. The result looks to me
like a vector that retains the old row names. I then sort the vector and
subsequently need to be abl
4 matches
Mail list logo