Re: [R] Referring to an object by a variable containing its name: 6 failures

2011-09-18 Thread andrewH
Thanks Josh & Duncan! That was very clear and helpful. After going back and reviewing documentation for "{" and "$" I am realizing that R the pattern in R documentation is simply to tell you the truth, and not to give much effort to distinguishing confusable choices. Once again, things that seemed

Re: [R] Referring to an object by a variable containing its name: 6 failures

2011-09-17 Thread Duncan Murdoch
On 17/09/2011 2:15 PM, Joshua Wiley wrote: Hi Andrew, On Sat, Sep 17, 2011 at 12:04 AM, andrewH wrote: > Dear Folks -- > The anonymous poster ("rmailbox") is perfectly correct. I had forgotten you > could use names in this way. When referring to rows or columns by name > rather than by nu

Re: [R] Referring to an object by a variable containing its name: 6 failures

2011-09-17 Thread Joshua Wiley
Hi Andrew, On Sat, Sep 17, 2011 at 12:04 AM, andrewH wrote: > Dear Folks -- > The anonymous poster ("rmailbox") is perfectly correct.  I had forgotten you > could use names in this way.  When referring to rows or columns by name > rather than by number, I usually use either attach() or the $ oper

Re: [R] Referring to an object by a variable containing its name: 6 failures

2011-09-17 Thread andrewH
Dear Folks -- The anonymous poster ("rmailbox") is perfectly correct. I had forgotten you could use names in this way. When referring to rows or columns by name rather than by number, I usually use either attach() or the $ operator, neither of which works here. If anyone understands why data.df[

Re: [R] Referring to an object by a variable containing its name: 6 failures

2011-09-16 Thread Eik Vettorazzi
Hi, maybe I did not get the point, but get() does exactly what you want: whatIwant = 2 nomdeplume = "whatIwant" get(nomdeplume) cheers Am 16.09.2011 16:09, schrieb Timothy Bates: > On 16 Sep 2011, at 1:49 AM, andrewH wrote: >>> I'm trying to make a function that takes column names then >>> usin

Re: [R] Referring to an object by a variable containing its name: 6 failures

2011-09-16 Thread Timothy Bates
On 16 Sep 2011, at 1:49 AM, andrewH wrote: >> I'm trying to make a function that takes column names then >> using the variable colName, containing the name of >> the column, to refer to the column itself rmail...@justemail.net said > What am I missing about your inquiry: It seems like x[ , colNam

Re: [R] Referring to an object by a variable containing its name: 6 failures

2011-09-15 Thread rmailbox
cat("\n")#6 } "ugly" } - Original message - From: "andrewH" To: r-help@r-project.org Date: Thu, 15 Sep 2011 17:49:22 -0700 (PDT) Subject: [R] Referring to an object by a variable containing its name: 6 failures Dear Folks-- I'm trying

[R] Referring to an object by a variable containing its name: 6 failures

2011-09-15 Thread andrewH
Dear Folks-- I'm trying to make a function that takes the columns I select from a data frame and then uses a for loop to print some information about each one, starting with the column name. I succeed in returning the column name, but nothing else I have tried using the variable colName, containin