[Sciviews-commits] r259 - pkg/svMisc/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Apr 30 21:26:16 CEST 2010


Author: prezez
Date: 2010-04-30 21:26:16 +0200 (Fri, 30 Apr 2010)
New Revision: 259

Modified:
   pkg/svMisc/R/objList.R
Log:
Small bug fixed in "svMisc:::lsObj" (objects are now evaluated in a proper environment)

Modified: pkg/svMisc/R/objList.R
===================================================================
--- pkg/svMisc/R/objList.R	2010-04-29 23:37:30 UTC (rev 258)
+++ pkg/svMisc/R/objList.R	2010-04-30 19:26:16 UTC (rev 259)
@@ -10,7 +10,7 @@
 	# Format envir as character (use only first item provided!)
 	if (!is.environment(envir)){
 		envir <- tryCatch(as.environment(envir), error = function(e) NULL)
-		if (is.null(envir) || inherits(envir, "try-error")) {
+		if (is.null(envir) || inherits(envir, "error")) {
 			envir <- NULL
 			ename <- ""
 		} else {
@@ -28,7 +28,7 @@
 	attr(Nothing, "all.info") <- all.info
 	attr(Nothing, "envir") <- ename
 	attr(Nothing, "object") <- object
-	attr(Nothing, "class") <- c("objList", "data.frame")
+	class(Nothing) <- c("objList", "data.frame")
 
 	if (is.null(envir))
 		return(Nothing)
@@ -185,7 +185,8 @@
 "lsObj" <-
 function (objname, envir, ...)
 {
-	obj <- try(eval(parse(text = objname)), silent = TRUE)
+	obj <- try(eval(parse(text = objname), envir = as.environment(envir)),
+			   silent = TRUE)
 	if (inherits(obj, "try-error"))
 		return(NULL)
 



More information about the Sciviews-commits mailing list