Re: [R] variable substitution in for loops

2010-03-07 Thread kulwinder banipal
010 20:56:26 -0500 > CC: r-help@r-project.org > Subject: Re: [R] variable substitution in for loops > > > On Feb 24, 2010, at 8:18 PM, Jon Erik Ween wrote: > > > Friends > > > > I can't quite find a direct answer to this question from the lists, >

Re: [R] variable substitution in for loops

2010-03-02 Thread Jon Erik Ween
Friends Seems I've run into another snag. More of the nitty-gritty r-details I don't understand. So, as I mentioned below, dataset[[var_sub]] seems to be understood well by the functions I previously used and I was able to run my loop successfully with the [[var_sub]] as a variable-substitutio

Re: [R] variable substitution in for loops

2010-03-01 Thread Uwe Ligges
On 01.03.2010 14:27, Jon Erik Ween wrote: Friends First, thanks to all for great feed-back. Open-source rocks! I have a workable solution to my question, attached below in case it might be of any use to anyone. I'm sure there are more elegant ways of doing this, so any further feedback is w

Re: [R] variable substitution in for loops

2010-03-01 Thread Jon Erik Ween
Friends First, thanks to all for great feed-back. Open-source rocks! I have a workable solution to my question, attached below in case it might be of any use to anyone. I'm sure there are more elegant ways of doing this, so any further feedback is welcome! Things I've learned (for other noobs

Re: [R] variable substitution in for loops

2010-02-24 Thread Peter Ehlers
Jon Erik, I don't know where you get 'varslist', but if it's from a text file, then why not scan() it into a *vector* instead of using (I assume) read.table() to create a data.frame. You'll save yourself much grief. -Peter Ehlers On 2010-02-24 20:19, David Winsemius wrote: On Feb 24, 2010, a

Re: [R] variable substitution in for loops

2010-02-24 Thread David Winsemius
On Feb 24, 2010, at 9:18 PM, Jon Erik Ween wrote: David Thanks for your suggestions. "Reproducible examples", my datasets are too big so I'm not sure what you would want to see. I _wanted_ to see a datasset that had maybe 10 variables and 20 rows and a stripped down varslist that had m

Re: [R] variable substitution in for loops

2010-02-24 Thread Jon Erik Ween
David Thanks for your suggestions. "Reproducible examples", my datasets are too big so I'm not sure what you would want to see. Anyway, does this help: dataset: Perf_Index Age risk_score gender hight IQ ... 12 78 10 m 6 110 ... 10 77 9 f 6 97 ... 5 64 f 13 5 120 ... ... varslist: Perf_Index Ag

Re: [R] variable substitution in for loops

2010-02-24 Thread David Winsemius
On Feb 24, 2010, at 8:18 PM, Jon Erik Ween wrote: Friends I can't quite find a direct answer to this question from the lists, so here goes: I have several dataframes, 200+ columns 2000+ rows. I wish to script some operations to perform on some of the variables (columns) in the data fra

[R] variable substitution in for loops

2010-02-24 Thread Jon Erik Ween
Friends I can't quite find a direct answer to this question from the lists, so here goes: I have several dataframes, 200+ columns 2000+ rows. I wish to script some operations to perform on some of the variables (columns) in the data frames not knowing what the column number is, hence have to r

Re: [R] variable substitution

2010-02-18 Thread Erik Iverson
Hello, Jon Erik Ween wrote: Hi I would like to write a script that reads a list of variable names. These variable names are some of the column headers in a data.frame. Then I want do a for-loop to execute various operations on the specified variables in the data.frame, but can't figure out ho

[R] variable substitution

2010-02-18 Thread Jon Erik Ween
Hi I would like to write a script that reads a list of variable names. These variable names are some of the column headers in a data.frame. Then I want do a for-loop to execute various operations on the specified variables in the data.frame, but can't figure out how to do the necessary variable