[Sciviews-commits] r10 - in pkg/svIDE: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jun 12 11:58:04 CEST 2008
Author: phgrosjean
Date: 2008-06-12 11:58:03 +0200 (Thu, 12 Jun 2008)
New Revision: 10
Modified:
pkg/svIDE/DESCRIPTION
pkg/svIDE/NEWS
pkg/svIDE/R/TinnR.R
pkg/svIDE/man/TinnR.Rd
Log:
Changes to Tinn-R object explorer functions in svIDE
Modified: pkg/svIDE/DESCRIPTION
===================================================================
--- pkg/svIDE/DESCRIPTION 2008-06-11 23:13:08 UTC (rev 9)
+++ pkg/svIDE/DESCRIPTION 2008-06-12 09:58:03 UTC (rev 10)
@@ -3,8 +3,8 @@
Imports: utils
Depends: R (>= 2.7.0), tcltk, svMisc
Description: Function for the GUI API to interact with external IDE/code editors
-Version: 0.9-42
-Date: 2008-06-09
+Version: 0.9-43
+Date: 2008-06-12
Author: Philippe Grosjean
Maintainer: Philippe Grosjean <phgrosjean at sciviews.org>
License: GPL (>= 2)
Modified: pkg/svIDE/NEWS
===================================================================
--- pkg/svIDE/NEWS 2008-06-11 23:13:08 UTC (rev 9)
+++ pkg/svIDE/NEWS 2008-06-12 09:58:03 UTC (rev 10)
@@ -1,5 +1,10 @@
= svIDE News
+== Changes in svIDE 0.9-43
+* trObjSearch() and trObjList() andre reworked in order to return results
+ similar to the old functions of the same name in svIDE < 0.9-40.
+
+
== Changes in svIDE 0.9-42
* getKeywords() is simplified by using lsf.str().
@@ -12,6 +17,7 @@
fixed (Tcl does not support names with dots, like max.width). Hence, the
argument is changed to width. Same for only.args that becomes onlyargs.
+
== Changes in svIDE 0.9-41
* One bug corrected in trObjSearch(): incorrect output of the results in a
character vector.
Modified: pkg/svIDE/R/TinnR.R
===================================================================
--- pkg/svIDE/R/TinnR.R 2008-06-11 23:13:08 UTC (rev 9)
+++ pkg/svIDE/R/TinnR.R 2008-06-12 09:58:03 UTC (rev 10)
@@ -4,17 +4,62 @@
# and objList() in the svMisc package
"trObjSearch" <-
-function (path = NULL) {
- return(invisible(objSearch(path = path, compare = FALSE)))
+function(path = NULL) {
+ res <- objSearch(sep = "\n", compare = FALSE)
+ if (is.null(path)) {
+ return(data.frame(search.. = strsplit(res, "\n")[[1]]))
+ } else {
+ cat("search..\n", res, "\n", sep = "", file = path)
+ }
}
"trObjList" <-
-function(id = "default", envir = .GlobalEnv, all.names = FALSE,
+function(id = "default", envir = ".GlobalEnv", all.names = TRUE,
pattern = "", group = "", path = NULL) {
- oWidth <- getOption("width")
- options(width = 100)
- on.exit(options(width = oWidth))
+ # Get data
+ res <- objList(id = id, envir = envir, all.names = all.names,
+ pattern = pattern, compare = FALSE)
- return(invisible(objList(id = id, envir = envir, all.names = all.names,
- pattern = pattern, group = group, path = path, compare = FALSE)))
+ if (length(res) == 1 && res == "") {
+ res <- data.frame("", "", "", "", stringsAsFactors = FALSE)
+ } else {
+ res <- data.frame(t(data.frame(strsplit(res, "\t"))),
+ stringsAsFactors = FALSE)[ , -5]
+ }
+ colnames(res) <- c("Name", "Dims", "Group", "Class")
+ rownames(res) <- NULL
+
+ # Group conversion
+ GrpTable <- c(
+ "vector", "vector", "vector", "vector",
+ "vector", "vector", "vector", "table",
+ "list", "function", "other", "other",
+ "other", "other")
+ names(GrpTable) <- c(
+ "numeric", "complex", "character", "logical",
+ "factor", "DateTime", "raw", "data.frame",
+ "list", "function", "NULL", "language",
+ "S3", "S4")
+ NewGroup <- GrpTable[res$Group]
+ NewGroup[NewGroup == "vector" & (regexpr("x", res$Dims) > -1)] <- "array"
+ NewGroup[NewGroup == "array" &
+ (regexpr("^[0-9]+x[0-9]+$", res$Dims) > -1)] <- "matrix"
+ res$Group <- NewGroup
+
+ # Filter according to group
+ if (group != "") {
+ if (group == "data") {
+ res <- res[NewGroup != "function", ]
+ } else {
+ res <- res[NewGroup == group, ]
+ }
+ }
+
+ # Final result
+ if (is.null(path)) {
+ return(res)
+ } else {
+ write.table(res, file = path, row.names = FALSE, quote = FALSE,
+ sep = "\t")
+ }
}
Modified: pkg/svIDE/man/TinnR.Rd
===================================================================
--- pkg/svIDE/man/TinnR.Rd 2008-06-11 23:13:08 UTC (rev 9)
+++ pkg/svIDE/man/TinnR.Rd 2008-06-12 09:58:03 UTC (rev 10)
@@ -8,7 +8,7 @@
}
\usage{
trObjSearch(path = NULL)
-trObjList(id = "default", envir = .GlobalEnv, all.names = FALSE,
+trObjList(id = "default", envir = .GlobalEnv, all.names = TRUE,
pattern = "", group = "", path = NULL)
}
@@ -35,9 +35,8 @@
\code{library(svIDE); library(svSocket); library(svIO); guiDDEInstall()}
}
\value{
- Depending on the function, a list, a string, a reference to an external,
- temporary file where data is written, or \code{TRUE} or \code{FALSE} invisibly
- depending if the function succeeds or not.
+ Either nothing if \code{path} is not null (data are written in a file given
+ by \code{path}), or a data frame with the results.
}
\author{Jose Claudio Faria (\email{joseclaudio.faria at terra.com.br}) &
More information about the Sciviews-commits
mailing list