[Sciviews-commits] r334 - komodo/SciViews-K/content pkg/svMisc/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 19 16:06:53 CEST 2010
Author: prezez
Date: 2010-10-19 16:06:53 +0200 (Tue, 19 Oct 2010)
New Revision: 334
Modified:
komodo/SciViews-K/content/pref-R.xul
komodo/SciViews-K/content/rsearch.html
pkg/svMisc/R/objList.R
Log:
rsearch.html: fixed - links to help topics did not work in new R version
pref-R.xul: bug corrected
svMisc::objList: bug fixed (base environment was listed as .GlobalEnv) (file omitted in previous update)
Modified: komodo/SciViews-K/content/pref-R.xul
===================================================================
--- komodo/SciViews-K/content/pref-R.xul 2010-10-15 07:09:46 UTC (rev 333)
+++ komodo/SciViews-K/content/pref-R.xul 2010-10-19 14:06:53 UTC (rev 334)
@@ -90,7 +90,7 @@
<label value="Command line arguments:"
control="svRArgs" pref="false" />
<textbox id="svRArgs" pref="true" editable="true" flex="1"
- oninput="PrefR_svRApplicationUpdate(event);"
+ oninput="PrefR_updateCommandLine(event);"
/>
<toolbarbutton
oncommand="sv.r.help("Startup")"
Modified: komodo/SciViews-K/content/rsearch.html
===================================================================
--- komodo/SciViews-K/content/rsearch.html 2010-10-15 07:09:46 UTC (rev 333)
+++ komodo/SciViews-K/content/rsearch.html 2010-10-19 14:06:53 UTC (rev 334)
@@ -28,18 +28,17 @@
function askR(topic) {
if (!topic) return;
- var cmd = 'svtmp <- help.search("' + topic + '")[];' +
+ var cmd = 'local({ svtmp <- help.search("' + topic + '")[];' +
'cat(svtmp$pattern, "\\n"); ' +
'if (nrow(svtmp$matches)) {' +
'svtmp$matches <- cbind(svtmp$matches, Path = apply(matrix(svtmp$matches[, c(1,3)], ncol=2), 1, function(z) c(help(z[1], package = z[2]))));' +
'write.table(svtmp$matches, sep=";", row.names = F, col.names = F, quote = F); ' +
'}; ' +
- 'rm(svtmp);';
+ 'rm(svtmp); }); ';
sv.r.evalCallback(cmd, displayResults);
}
-
function appendElem(parent, tagName, textContent, attributes) {
var el = document.createElement(tagName);
@@ -131,7 +130,7 @@
cmd += topic? ' topic = "' + topic + '", ' : "";
//cmd = 'cat(unclass(help(' + cmd + ' htmlhelp = TRUE)))';
// For R 2.10:
- cmd = 'cat(getHelpURL(help(' + cmd + ' htmlhelp = TRUE)))';
+ cmd = 'cat(getHelpURL(help(' + cmd + ')))';
res = sv.r.evalCallback(cmd, function(path) {
rHelpWin.go(path, Components.interfaces.nsIWebNavigation
Modified: pkg/svMisc/R/objList.R
===================================================================
--- pkg/svMisc/R/objList.R 2010-10-15 07:09:46 UTC (rev 333)
+++ pkg/svMisc/R/objList.R 2010-10-19 14:06:53 UTC (rev 334)
@@ -5,31 +5,50 @@
## Make sure that id is character
id <- as.character(id)[1]
if (id == "") id <- "default"
+ ename <- NA
## 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, "error")) {
- envir <- NULL
- ename <- ""
- } else {
- ename <- if (is.null(attr(envir, "name"))) ".GlobalEnv" else
- attr(envir, "name")
+ if(is.numeric(envir) && envir > 0)
+ envir <- search()[envir]
+
+ if (is.character(envir)) {
+ ename <- envir
+ envir <- tryCatch(as.environment(envir), error = function(e) NULL)
+ if (is.null(envir) || inherits(envir, "error")) {
+ envir <- NULL
+ ename <- ""
+ }
}
- } else {
- ename <- deparse(substitute(envir))
}
+ # base and .GlobalEnv do not have name attribute
+ if (!is.null(attr(envir, "name"))) ename <- attr(envir, "name")
+ else if (is.na(ename)) ename <- deparse(substitute(envir))
+ if (ename %in% c("baseenv()", ".BaseNamespaceEnv"))
+ ename <- "package:base"
+
+
## Object to return in case of empty data
- Nothing <- data.frame(Envir = character(0), Name = character(0),
+ #Nothing <- data.frame(Envir = character(0), Name = character(0),
+ # Dims = character(0), Group = character(0), Class = character(0),
+ # Recursive = logical(0), stringsAsFactors = FALSE)
+ #if (!isTRUE(all.info)) Nothing <- Nothing[, -1]
+ #attr(Nothing, "all.info") <- all.info
+ #attr(Nothing, "envir") <- ename
+ #attr(Nothing, "object") <- object
+ #class(Nothing) <- c("objList", "data.frame")
+
+ # This is ~15x faster:
+ Nothing <- structure(list(Name = character(0),
Dims = character(0), Group = character(0), Class = character(0),
- Recursive = logical(0), stringsAsFactors = FALSE)
- if (!isTRUE(all.info)) Nothing <- Nothing[, -1]
- attr(Nothing, "all.info") <- all.info
- attr(Nothing, "envir") <- ename
- attr(Nothing, "object") <- object
- class(Nothing) <- c("objList", "data.frame")
+ Recursive = logical(0), stringsAsFactors = FALSE),
+ class=c("objList", "data.frame"),
+ all.info= all.info, envir=ename, object=object
+ )
+ if (isTRUE(all.info)) Nothing <- cbind(Envir = character(0), Nothing)
+
if (is.null(envir)) return(Nothing)
if (!missing(object) && is.character(object) && object != "") {
@@ -57,7 +76,6 @@
res <- data.frame(t(sapply(Items, describe, all.info = all.info)),
stringsAsFactors = FALSE)
-
# Quote non-syntactic names
nsx <- res$Name != make.names(res$Name)
res$Full.name[!nsx] <- res$Name[!nsx]
More information about the Sciviews-commits
mailing list