[Sciviews-commits] r4 - in pkg: svMisc svMisc/R svSocket svSocket/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 5 17:15:11 CEST 2008


Author: phgrosjean
Date: 2008-06-05 17:15:11 +0200 (Thu, 05 Jun 2008)
New Revision: 4

Modified:
   pkg/svMisc/NEWS
   pkg/svMisc/R/objMenu.R
   pkg/svMisc/R/objSearch.R
   pkg/svSocket/NEWS
   pkg/svSocket/R/processSocket.R
Log:
Bugs corrections in processSocket() and objSearch()

Modified: pkg/svMisc/NEWS
===================================================================
--- pkg/svMisc/NEWS	2008-06-04 09:01:20 UTC (rev 3)
+++ pkg/svMisc/NEWS	2008-06-05 15:15:11 UTC (rev 4)
@@ -5,6 +5,9 @@
 ---------------
 - objInfo() returns also estimated size of objects that are not functions.
 
+- objSearch() is reworked to return a single string using 'sep' as separator
+  when sep is not NULL.
+
 Version 0.9-40:
 ---------------
 This is the first version distributed on R-forge. It is completely refactored

Modified: pkg/svMisc/R/objMenu.R
===================================================================
--- pkg/svMisc/R/objMenu.R	2008-06-04 09:01:20 UTC (rev 3)
+++ pkg/svMisc/R/objMenu.R	2008-06-05 15:15:11 UTC (rev 4)
@@ -1,6 +1,7 @@
 "objMenu" <-
 function(id = "default", envir = .GlobalEnv, objects = "", sep = "\t",
-	path = NULL) {	
+	path = NULL) {
+	### TODO: look also in .required in .GlobalEnv to determine if one can detach a package
 	### TODO: copy name to clipboard, send name to editor in menu
 
 	# Get a context menu  for given object(s) or environment

Modified: pkg/svMisc/R/objSearch.R
===================================================================
--- pkg/svMisc/R/objSearch.R	2008-06-04 09:01:20 UTC (rev 3)
+++ pkg/svMisc/R/objSearch.R	2008-06-05 15:15:11 UTC (rev 4)
@@ -1,22 +1,26 @@
 "objSearch" <-
 function(sep = "\t", path = NULL, compare = TRUE) {
-    Search <- as.matrix(data.frame(Workspace = search()))
+    Search <- search()
 	if (compare) {
 		oldSearch <- getTemp(".guiObjSearchCache", default = "")
 		# Compare both versions
-		if (!(all.equal(Search, oldSearch)[1] == TRUE)) {
+		if (length(Search) != length(oldSearch) || !all.equal(Search, oldSearch)) {
 			# Keep a copy of the last version in TempEnv
 			assignTemp(".guiObjSearchCache", Search) 
 			Changed <- TRUE
 		} else Changed <- FALSE
 	} else Changed <- TRUE
-    if (is.null(path)) { # Simply return result
-		if (Changed) return(Search) else return("")
+    if (is.null(path)) { # Return result, as a single character string with sep
+		if (Changed) {
+			if (!is.null(sep)) Search <- paste(Search, collapse = sep)	
+			return(Search)
+		} else return("")
 	} else { # Write to a file called 'Search.txt' in this path
 		file <- file.path(path, "Search.txt")	
-		if (Changed)
-			write.table(Search, file = file, row.names = FALSE, quote = FALSE,
-				sep = sep)
+		if (Changed) {
+			if (is.null(sep)) sep <- "\n"
+			cat(Search, sep = sep, file = file)
+		}
 		return(Changed)
 	}
 }

Modified: pkg/svSocket/NEWS
===================================================================
--- pkg/svSocket/NEWS	2008-06-04 09:01:20 UTC (rev 3)
+++ pkg/svSocket/NEWS	2008-06-05 15:15:11 UTC (rev 4)
@@ -1,6 +1,12 @@
 svSocket News:
 ==============
 
+Version 0.9-41:
+---------------
+- Correction of a bug preventing processSocket() to display error messages.
+  Instead, I got: Error in ngettext(1, "Error: ", domain = "R") : 
+      argument "msg2" is missing, with no default
+
 Version 0.9-40:
 ---------------
 This is the first version distributed on R-forge. It is completely refactored

Modified: pkg/svSocket/R/processSocket.R
===================================================================
--- pkg/svSocket/R/processSocket.R	2008-06-04 09:01:20 UTC (rev 3)
+++ pkg/svSocket/R/processSocket.R	2008-06-05 15:15:11 UTC (rev 4)
@@ -88,7 +88,7 @@
     expr <- Parse(msg)
     # Is it a wrong code?
     if (inherits(expr, "try-error")) {
-        res <- paste(ngettext(1, "Error: ", domain = "R"),
+        res <- paste(ngettext(1, "Error: ", "", domain = "R"),
         sub("^[^:]+: ([^\n]+)\n[0-9]+:(.*)$", "\\1\\2", expr), sep = "")
         if (Echo) cat(res)
         return(paste(res, pars$last, Prompt, sep = ""))



More information about the Sciviews-commits mailing list