Re: [R] Change case of factor in data frame

2012-12-03 Thread David Winsemius
On Dec 3, 2012, at 3:34 PM, Audrey wrote: res=names(dat); get(res[ind],pos=dat) will retrieve dat$name There are far less baroque was of doing that (including dat$name and dat[["name"]]. Both dat$name and dat[["name"]] require you to know what "name" is. I was looking for a way to retriev

Re: [R] Change case of factor in data frame

2012-12-03 Thread Audrey
> res=names(dat); > get(res[ind],pos=dat) will retrieve dat$name There are far less baroque was of doing that (including dat$name and dat[["name"]]. Both dat$name and dat[["name"]] require you to know what "name" is. I was looking for a way to retrieve a data frame column by name without actua

Re: [R] Change case of factor in data frame

2012-12-03 Thread David Winsemius
On Dec 2, 2012, at 12:46 PM, Audrey wrote: I am trying to write a function to change the case of all of the text in a data frame to lower case. Define what you mean by "text". I do not have foreknowledge of the data frame names or the data types of each column. It seems that if one ref

Re: [R] Change case of factor in data frame

2012-12-03 Thread David Winsemius
On Dec 3, 2012, at 9:47 AM, Audrey wrote: Ok, it seems that the function to get generic field names is get() Er, not really. res=names(dat); get(res[ind],pos=dat) will retrieve dat$name There are far less baroque was of doing that (including dat$name and dat[["name"]]. Read: ?"[" I

Re: [R] Change case of factor in data frame

2012-12-03 Thread Audrey
Ok, it seems that the function to get generic field names is get() res=names(dat); get(res[ind],pos=dat) will retrieve dat$name -- View this message in context: http://r.789695.n4.nabble.com/Change-case-of-factor-in-data-frame-tp4651696p4651919.html Sent from the R help mailing list archive at

[R] Change case of factor in data frame

2012-12-02 Thread Audrey
I am trying to write a function to change the case of all of the text in a data frame to lower case. I do not have foreknowledge of the data frame names or the data types of each column. It seems that if one references the data frame by index, then it returns class "data.frame" but if it is refe