Re: [R] change value in one cell

2011-06-11 Thread jour4life
That's great! But, I guess I should have provided a better example for my problem. The reason being that I did not consider strings. For instance, in my case, I'm actually trying to add a value to a data frame that looks like this: Obs X 0 NA 1 01 001 2 01 002 3 01 003 And

Re: [R] change value in one cell

2011-06-11 Thread Rolf Turner
On 11/06/11 18:14, jour4life wrote: That's great! But, I guess I should have provided a better example for my problem. The reason being that I did not consider strings. For instance, in my case, I'm actually trying to add a value to a data frame that looks like this: Obs X 0 NA 1 01

Re: [R] change value in one cell

2011-06-11 Thread Jim Holtman
your dataframe has X as a factor; convert to character vector and try again. x$X - as.character(x$X) Sent from my iPad On Jun 11, 2011, at 2:14, jour4life jour4l...@gmail.com wrote: That's great! But, I guess I should have provided a better example for my problem. The reason being that I

[R] change value in one cell

2011-06-10 Thread jour4life
Hello all, I am wondering if there is a way to change the value of one cell in R. For instance let's say I have a hypothetical data frame that looks like this: Obs X Y Z 11 0 1 20 0 1 31 1 1 40 1 1 51 1 0 60 0 0 I would like to change the value of the 4th observation in

Re: [R] change value in one cell

2011-06-10 Thread jim holtman
you probably need to read the Introduction to R to understand indexing: x Obs X Y Z 1 1 1 0 1 2 2 0 0 1 3 3 1 1 1 4 4 0 1 1 5 5 1 1 0 6 6 0 0 0 x[4, Y] - 0 x Obs X Y Z 1 1 1 0 1 2 2 0 0 1 3 3 1 1 1 4 4 0 0 1 5 5 1 1 0 6 6 0 0 0 On Fri, Jun 10, 2011 at 5:42 PM,