Re: [R] Finding the position of a variable in a data.frame

2006-08-03 Thread Gabor Grothendieck
On 8/3/06, John Kane <[EMAIL PROTECTED]> wrote: > > --- Don MacQueen <[EMAIL PROTECTED]> wrote: > > > You don't need to find out the column index. This > > works: > > > > Df[5,'bat'] <- 100 > > > > -Don > > > > Thanks, I'd tried > Df[5, bat] <- 100 :( > > I never thought of the ' ' being neede

Re: [R] Finding the position of a variable in a data.frame

2006-08-03 Thread John Kane
--- Don MacQueen <[EMAIL PROTECTED]> wrote: > You don't need to find out the column index. This > works: > > Df[5,'bat'] <- 100 > > -Don > Thanks, I'd tried Df[5, bat] <- 100 :( I never thought of the ' ' being needed. > At 5:01 PM -0400 8/2/06, John Kane wrote: > >Simple problem bu

Re: [R] Finding the position of a variable in a data.frame

2006-08-03 Thread Don MacQueen
You don't need to find out the column index. This works: Df[5,'bat'] <- 100 -Don At 5:01 PM -0400 8/2/06, John Kane wrote: >Simple problem but I don't see the answer. I'm trying >to clean up some data >I have 120 columns in a data.frame. I have one value >in a column named "blaw" that I wan

Re: [R] Finding the position of a variable in a data.frame

2006-08-02 Thread Gerald Jansen
On Wed, 02 Aug 2006 17:12:53 -0400, Chuck Cleland wrote: > Why not do it this way? > > Df$bat <- replace(Df$bat, Df$bat >=50, 100) Is that any different, performancewise, than the following? Df$bat[Df$bat >= 50] <- 100 Gerald Jansen ... John Kane wrote: > Simple example > > cat <- c( 3,5,6,8

Re: [R] Finding the position of a variable in a data.frame

2006-08-02 Thread John Kane
--- roger koenker <[EMAIL PROTECTED]> wrote: > it is the well-known wicked which problem: if you > had (grammatically > incorrectly) > thought "... which I want to change" then you might > have been led > to type (in another window): > > ?which > > and you would have seen the light. M

Re: [R] Finding the position of a variable in a data.frame

2006-08-02 Thread John Kane
--- Chuck Cleland <[EMAIL PROTECTED]> wrote: > John Kane wrote: > > Simple problem but I don't see the answer. I'm > trying > > to clean up some data > > I have 120 columns in a data.frame. I have one > value > > in a column named "blaw" that I want to change. > How do > > I find the coordinates

Re: [R] Finding the position of a variable in a data.frame

2006-08-02 Thread Chuck Cleland
John Kane wrote: > Simple problem but I don't see the answer. I'm trying > to clean up some data > I have 120 columns in a data.frame. I have one value > in a column named "blaw" that I want to change. How do > I find the coordinates. I can find the row by doing a > subset on the data.frame but ho

Re: [R] Finding the position of a variable in a data.frame

2006-08-02 Thread roger koenker
it is the well-known wicked which problem: if you had (grammatically incorrectly) thought "... which I want to change" then you might have been led to type (in another window): ?which and you would have seen the light. Maybe that() should be an alias for which()? url:www.econ.uiu

Re: [R] Finding the position of a variable in a data.frame

2006-08-02 Thread John Kane
--- jim holtman <[EMAIL PROTECTED]> wrote: > ?which > > > which(Df >= 50, arr.ind=T) > row col > 5 5 4 I knew it was going to be blinding obvious! I even read ?which somehow misunderstood arr.ind. Thanks again. > > On 8/2/06, John Kane <[EMAIL PROTECTED]> wrote: > > > > Simple probl

Re: [R] Finding the position of a variable in a data.frame

2006-08-02 Thread jim holtman
?which > which(Df >= 50, arr.ind=T) row col 5 5 4 On 8/2/06, John Kane <[EMAIL PROTECTED]> wrote: > > Simple problem but I don't see the answer. I'm trying > to clean up some data > I have 120 columns in a data.frame. I have one value > in a column named "blaw" that I want to change. How

[R] Finding the position of a variable in a data.frame

2006-08-02 Thread John Kane
Simple problem but I don't see the answer. I'm trying to clean up some data I have 120 columns in a data.frame. I have one value in a column named "blaw" that I want to change. How do I find the coordinates. I can find the row by doing a subset on the data.frame but how do I find out here "blaw "