

Thanks!

That's exactly it.
get gets it ;-)

Berry


From: michael.weylandt@gmail.com
Date: Wed, 7 Sep 2011 14:54:48 -0500
Subject: Re: [R] access objects
To: berryboessenkool@hotmail.com
CC: r-help@r-project.org

The get() function should get you where you need. 

Michael Weylandt

On Wed, Sep 7, 2011 at 12:53 PM, Berry Boessenkool <berryboessenkool@hotmail.com> wrote:






hi,



say I have consecutively numbered objects obj1, obj2, ... in my R workspace.

I want to acces one of them inside a function, with the number given as an argument.



Where can I find help on how to do that? Somebody must have been trying to do this before...

Some keywords to start a search are appreciated as well.



Here's an example, I hope it clarifies what I'm trying to do:



obj1 <- 7:9

obj2 <- 6:2

testf <- function(k) plot(  noquote(paste("obj", k, sep=""))  )

testf(1) # should plot obj1







-------------------------------------

Berry Boessenkool

D-14476 Potsdam (OT Golm)

-------------------------------------



______________________________________________

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.


 		 	   		  
	[[alternative HTML version deleted]]

