Skip to content
Back to formatted view

Raw Message

Message-ID: <1317835117366-3875488.post@n4.nabble.com>
Date: 2011-10-05T17:18:37Z
From: sina rueeger
Subject: reporting multiple objects out of a function
In-Reply-To: <1317788874982-3873380.post@n4.nabble.com>

Hi Andrew

I am not sure if I understood your question entirely. You want to store some
objects, but not in the global environment. Correct?! I would do it like
this (although I am sure that there is a more elegant way to do this).

## ----------------------------------------------------------------
obj1 <- 2
attach(what = NULL, name = "my_env")  	##?create new environment
assign("obj1", obj1, envir = as.environment("my_env"))  ## assign obj1 to
new environment

rm(list = ls()) ##?remove all objects from global environment

obj1  ##?still available
ls("my_env")  ##?still available in environment "my_env"
## ----------------------------------------------------------------

Regards,
Sina

--
View this message in context: http://r.789695.n4.nabble.com/reporting-multiple-objects-out-of-a-function-tp3873380p3875488.html
Sent from the R help mailing list archive at Nabble.com.