Re: [R] Q: selecting a name when it is known as a string

2007-09-06 Thread Gustaf Rydevik
On 9/5/07, D. R. Evans [EMAIL PROTECTED] wrote: D. R. Evans said the following at 09/04/2007 04:14 PM : I am 100% certain that there is an easy way to do this, but after I have reconsidered this and now believe it to be essentially impossible (or at the very least remarkably difficult)

Re: [R] Q: selecting a name when it is known as a string

2007-09-06 Thread Gustaf Rydevik
On 9/6/07, Gustaf Rydevik [EMAIL PROTECTED] wrote: On 9/5/07, D. R. Evans [EMAIL PROTECTED] wrote: D. R. Evans said the following at 09/04/2007 04:14 PM : I am 100% certain that there is an easy way to do this, but after I have reconsidered this and now believe it to be essentially

Re: [R] Q: selecting a name when it is known as a string

2007-09-05 Thread D. R. Evans
D. R. Evans said the following at 09/04/2007 04:14 PM : I am 100% certain that there is an easy way to do this, but after I have reconsidered this and now believe it to be essentially impossible (or at the very least remarkably difficult) although I don't understand why it is so :-( At least, I

Re: [R] Q: selecting a name when it is known as a string

2007-09-05 Thread Greg Snow
If your main goal is to do a loess fit, then make predictions from that, then using the 'get' function may do what you want: tmp.var - get(ORDINATE) lo - loess(percent ~ ncms * tmp.var, d, ... grid - expand.grid(tmp.var=MINVAL:MAXVAL, ncms=MINCMS:MAXCMS) predict(lo, grid) Here you stick with

Re: [R] Q: selecting a name when it is known as a string

2007-09-05 Thread Tony Plate
For the column names of the result of expand.grid(), I would just assign them the values I wanted, like this: x - expand.grid(tmp=1:3,y=1:2) x tmp y 1 1 1 2 2 1 3 3 1 4 1 2 5 2 2 6 3 2 colnames(x)[1] - whatever x whatever y 11 1 22 1 33 1 4

[R] Q: selecting a name when it is known as a string

2007-09-04 Thread D. R. Evans
I am 100% certain that there is an easy way to do this, but after experimenting off and on for a couple of days, and searching everywhere I could think of, I haven't been able to find the trick. I have this piece of code: ... attach(d) if (ORDINATE == 'ds') { lo - loess(percent ~ ncms *

Re: [R] Q: selecting a name when it is known as a string

2007-09-04 Thread Peter Dalgaard
D. R. Evans wrote: I am 100% certain that there is an easy way to do this, but after experimenting off and on for a couple of days, and searching everywhere I could think of, I haven't been able to find the trick. I have this piece of code: ... attach(d) if (ORDINATE == 'ds') { lo

Re: [R] Q: selecting a name when it is known as a string

2007-09-04 Thread Tony Plate
You can use substitute() for this. The drawback with this approach is that the formula in the call in the printed value of loess() is ugly. x - data.frame(y=rnorm(20), x1=rnorm(20), x2=rnorm(20)) loess(y~x2, data=x) Call: loess(formula = y ~ x2, data = x) Number of Observations: 20