Re: [R] Updating a data frame based on if condition

2014-02-18 Thread Jeff Johnson
anging a condition is pretty simple > > David C > > From: Jeff Johnson [mailto:mrjeffto...@gmail.com] > Sent: Tuesday, February 18, 2014 12:54 PM > To: dcarl...@tamu.edu > Cc: R help > Subject: Re: [R] Updating a data frame based on if condition > > Ahh, I was

Re: [R] Updating a data frame based on if condition

2014-02-18 Thread David Carlson
E FALSE FALSE TRUE TRUE FALSE TRUE FALSE FALSE TRUE TRUE [49] TRUE TRUE And adding or changing a condition is pretty simple David C From: Jeff Johnson [mailto:mrjeffto...@gmail.com] Sent: Tuesday, February 18, 2014 12:54 PM To: dcarl...@tamu.edu Cc: R help Subject: Re: [R] Updating a d

Re: [R] Updating a data frame based on if condition

2014-02-18 Thread arun
Hi, I don't know whether the 'mydata" object was updated or not before you run the table. mydata <- within(mydata,FNAME_SUSPECT <- FNAME_TOKEN_COUNT >10|FNAME_LENGTH>45|regexpr("9",FNAME_PATTERN)==0) table(mydata$FNAME_SUSPECT) # #FALSE #   50 Now, your second condition (reply to Davi

Re: [R] Updating a data frame based on if condition

2014-02-18 Thread Jeff Johnson
R Cookbook. > > > On Tue, Feb 18, 2014 at 10:16 AM, David Carlson wrote: > >> Not always true, but it is in this case: >> >> ?ifelse >> >> David C >> >> -Original Message- >> From: r-help-boun...@r-project.org >> [mailto:r-he

Re: [R] Updating a data frame based on if condition

2014-02-18 Thread Jeff Johnson
.@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Jeff Johnson > Sent: Tuesday, February 18, 2014 11:24 AM > To: R help > Subject: [R] Updating a data frame based on if condition > > I have a subset of data that I have identified as "suspect" (f

Re: [R] Updating a data frame based on if condition

2014-02-18 Thread David Carlson
Not always true, but it is in this case: ?ifelse David C -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jeff Johnson Sent: Tuesday, February 18, 2014 11:24 AM To: R help Subject: [R] Updating a data frame based on if condition I

[R] Updating a data frame based on if condition

2014-02-18 Thread Jeff Johnson
I have a subset of data that I have identified as "suspect" (for example, the first name has excessive spaces, is longer than 35 characters or has a number). What I want to do is update the FNAME_SUSPECT field in "mydata" to TRUE if any of those conditions are met. Here's my data: > dput(mydata)