Re: [R] Changing names of a string variable

2010-12-07 Thread David Winsemius
On Dec 7, 2010, at 2:31 PM, Erik Iverson wrote: Hello, To do what you want, see ?toupper : levels(dat$target) <- toupper(levels(dat$target)) However, for clarity, dat$target is not a "string variable", it is a factor, which you can verify with > str(dat) And to further clarify, it is a f

Re: [R] Changing names of a string variable

2010-12-07 Thread Erik Iverson
Phil Spector wrote: Jahan - Try dat$target = toupper(dat$target) Note that in this case, the above *will* coerce dat$target to a character vector, which may or may not be what is intended. __ R-help@r-project.org mailing list https://stat.ethz

Re: [R] Changing names of a string variable

2010-12-07 Thread Phil Spector
Jahan - Try dat$target = toupper(dat$target) I would not recommend a loop for something like this. (You might also want to brush up on your python, because what you're trying doesn't work in python either.) - Phil Spector

Re: [R] Changing names of a string variable

2010-12-07 Thread Erik Iverson
Hello, To do what you want, see ?toupper : levels(dat$target) <- toupper(levels(dat$target)) However, for clarity, dat$target is not a "string variable", it is a factor, which you can verify with > str(dat) Factors are enumerated types, and have a discrete set of 'levels' associated with the