Re: [R] creating a derived variable in a data frame

2005-10-20 Thread Johnson, Andrea
Check out this website for a couple examples of how to use transform() and replace() - (look under recode): http://www.ku.edu/~pauljohn/R/Rtips.html -Andrea >Hello, > >I have read through the manuals and can't seem to find an answer. > >I have a categorical, character variable that has hundr

Re: [R] creating a derived variable in a data frame

2005-10-20 Thread Greg Snow
"Martin Henry H. Stevens" <[EMAIL PROTECTED]> 10/20/05 08:47AM >>> >Hi Avram- >How many countries do you have? >I would do it the following way because it is simple and I don't know >any better, even if it is absurdly painstaking. > >#Step 1 >mydata$continent <- factor(NA, levels=c("NoAm","

Re: [R] creating a derived variable in a data frame

2005-10-20 Thread Martin Henry H. Stevens
Hi Avram- How many countries do you have? I would do it the following way because it is simple and I don't know any better, even if it is absurdly painstaking. #Step 1 mydata$continent <- factor(NA, levels=c("NoAm","Euro")) #Steps 2 a-z mydata$continent[mydata$country=="US" |

Re: [R] creating a derived variable in a data frame

2005-10-19 Thread ronggui
I suggest you use the recode function in car package to do your job. === 2005-10-20 08:09:08 您在来信中写道:=== >Hello, > >I have read through the manuals and can't seem to find an answer. > >I have a categorical, character variable that has hundreds of values. I want >to group the ex

[R] creating a derived variable in a data frame

2005-10-19 Thread Avram Aelony
Hello, I have read through the manuals and can't seem to find an answer. I have a categorical, character variable that has hundreds of values. I want to group the existing values of this variable into a new, derived (categorical) variable by applying conditions to the values in the data. For