Hi Everyone , I am having an issue with the following code and would need kind assistant.
For a specific reason , I would need to create a new environment for variables within the function and use them and I am having issue with it on the project I am doing. The issue is that no matter what I do , I am getting the following error on "Error in eval(expr, envir, enclos) : object 'x3' not found" and it is the x3 that is within the groupedData(y~-1 + x3 | g and not in the data.frame fun1 <- function() { ee <- new.env() t <- 10 x <- 5 g<- 8 assign("x2",x,envir = as.environment(ee)) x3 <- get("x2" , envir = as.environment(ee)) if(t == 10) { if(g == 8) { data.fr <- groupedData(y~-1 + x3 | g, data=data.frame(y,x3,h, dummy)) } } } Thanks and Regards Billy [[alternative HTML version deleted]] ______________________________________________ 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.