Re: [R] combining numeric vector and column in a data frame

2012-07-10 Thread Rui Barradas
Hello, Here are two ways of doing it. df1 <- read.table(text=" fileNametype status b N alive a Tdead d N alive c T dead f Nalive e Tdead ", header=TRUE) df1 my.num

Re: [R] combining numeric vector and column in a data frame

2012-07-10 Thread arun
ileName mynumeric.vec type 1    a 2    T 2    b 1    N 3    c 4    T 4    d 9    N 5    e    10    T 6    f 3    N A.K. - Original Message - From: Adrian Johnson To: r-help Cc: Sent: Tuesday, July

[R] combining numeric vector and column in a data frame

2012-07-10 Thread Simon Knapp
combined <- data.frame(mnv=my.numeric.vec[df1$fileName], type=df1$type) sorted <- combined[order(rownames(combined)),] On Wed, Jul 11, 2012 at 8:38 AM, Adrian Johnson wrote: > Hi: > I am trying to map column names of a matrix to another data frame and > get values in a different column of data

[R] combining numeric vector and column in a data frame

2012-07-10 Thread Adrian Johnson
Hi: I am trying to map column names of a matrix to another data frame and get values in a different column of data frame I have a matrix m. > my.numeric vec <- m[1,] > my.numeric.vec a b cd ef 2 1 49 10 3 ## my data frame = df1 > df1 fileNametype sta