[R] assigning values to parameters, based on different names

2009-12-01 Thread Jannis

Dear R help community,


I have tumbleled across some problem quite often and could not find a
solution for it (or was not able to google the right terms).

I am wondering whether there is a way to tell R to assign a value of
parameter X to parameter B while the actual name of parameter X is given
by parameter C. Like this:



C-name of parameter X

B- parameter X which has the name == C


In that way I can easily change the value of  C and then assign the
values of different parameters to B, depending on which name I entered
and saved as parameter C, which would help me dealing with automatic
loops a lot!

Like this:


for (i in 1:3)
{
  C-c(name1,name2,name3)[i]
  B-'parameter with name C'
}

Appreciate any suggestions!

Best
Jannis

P.S. And thanks to all for the amazing answers posted to r-help that
already helped me so many times!

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] assigning values to parameters, based on different names

2009-12-01 Thread Karl Ove Hufthammer
On Tue, 01 Dec 2009 12:45:18 + Jannis bt_jan...@yahoo.de wrote:
 I am wondering whether there is a way to tell R to assign a value of
 parameter X to parameter B while the actual name of parameter X is given
 by parameter C. Like this:

Yes. See ?get.

-- 
Karl Ove Hufthammer

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.