Re: [R] Error setting rowname if rowname currently NULL

2009-03-03 Thread Wacek Kusnierczyk
snubian wrote: > I've noticed a behaviour when using rownames() that I think is odd, > wondering if I'm doing something wrong. > > To illustrate, say I create a very simple matrix (called fred): > > fred<-matrix(,4,2) > > It looks like this: > > [,1] [,2] > [1,] NA NA > [2,] NA NA >

Re: [R] Error setting rowname if rowname currently NULL

2009-03-02 Thread Chunhao Tu
om: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of snubian Sent: Monday, March 02, 2009 4:59 PM To: r-help@r-project.org Subject: [R] Error setting rowname if rowname currently NULL Hi, My first post here and new to R so please bear with me (long time program

Re: [R] Error setting rowname if rowname currently NULL

2009-03-02 Thread jim holtman
THe problem is that 'rownames(fred)' is NULL and therefore you will have to define the names of all the rows: > fred<-matrix(,4,2) > fred [,1] [,2] [1,] NA NA [2,] NA NA [3,] NA NA [4,] NA NA > rownames(fred) NULL > rownames(fred) <- c("Apple",'','','') > fred [,1] [,2]

[R] Error setting rowname if rowname currently NULL

2009-03-02 Thread snubian
Hi, My first post here and new to R so please bear with me (long time programmer though, helping a friend with some scripts). I've noticed a behaviour when using rownames() that I think is odd, wondering if I'm doing something wrong. To illustrate, say I create a very simple matrix (called fred