Re: [R] print all variables inside function

2016-05-23 Thread William Dunlap via R-help
If you really want to return all the objects in a function, I think it is better to return as.list(environment()), perhaps adding the all.names=TRUE argument to capture names starting with a dot. I only have done this while debugging a function and then I find it is more convenient to return just e

Re: [R] print all variables inside function

2016-05-23 Thread Thierry Onkelinx
Dear Jan, This will return a list with all objects from within the function. test <- function(){ a <- 10 b <- 3 * a + 1 x <- -1 output <- paste(objects(), objects(), sep = "=") output <- paste(output, collapse = ",") output <- paste("list(", output, ")") return(eval(parse(text = out

Re: [R] print all variables inside function

2016-05-23 Thread Duncan Murdoch
On 23/05/2016 3:26 PM, Jan Kacaba wrote: Hello dear R-help I would like to use some short and simple names multiple times inside one script without collisions. I need to wrap the variables inside some object. I know I can use class function or environment. For example as follows: exmp1<-functio

[R] print all variables inside function

2016-05-23 Thread Jan Kacaba
Hello dear R-help I would like to use some short and simple names multiple times inside one script without collisions. I need to wrap the variables inside some object. I know I can use class function or environment. For example as follows: exmp1<-function(){ # knowns pa=0.35 pb=0.35 pc=