[Sciviews-commits] r5 - in pkg/svMisc: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jun 5 22:21:44 CEST 2008
Author: phgrosjean
Date: 2008-06-05 22:21:44 +0200 (Thu, 05 Jun 2008)
New Revision: 5
Modified:
pkg/svMisc/R/objList.R
pkg/svMisc/R/objSearch.R
pkg/svMisc/man/objBrowse.Rd
Log:
Slight modifications to objSearch() & objList()
Modified: pkg/svMisc/R/objList.R
===================================================================
--- pkg/svMisc/R/objList.R 2008-06-05 15:15:11 UTC (rev 4)
+++ pkg/svMisc/R/objList.R 2008-06-05 20:21:44 UTC (rev 5)
@@ -1,6 +1,7 @@
"objList" <-
function(id = "default", envir = .GlobalEnv, object = "", all.names = FALSE,
-pattern = "", group = "", sep = "\t", path = NULL, compare = TRUE) {
+pattern = "", group = "", all.info = FALSE, sep = "\t", path = NULL,
+compare = TRUE) {
# Make sure that id is character
id <- as.character(id)[1]
@@ -19,13 +20,18 @@
if (object == "") {
# Get the list of objects in this environment
Items <- ls(pos = pos, all.names = all.names, pattern = pattern)
- if (length(Items) == 0)
+ if (length(Items) == 0) if (all.info) {
return(data.frame(Name = character(), Dims = character(),
Group = character(), Class = character(),
Recusive = logical(), stringsAsFactors = FALSE))
+ } else {
+ return(data.frame(Envir = character(), Name = character(),
+ Dims = character(), Group = character(), Class = character(),
+ Recusive = logical(), stringsAsFactors = FALSE))
+ }
# Get characteristics of all objects
- "describe" <- function(name, pos = 1) {
+ "describe" <- function(name, pos = ".GlobalEnv", all.info = FALSE) {
# get a vector with five items:
# Name, Dims, Group, Class and Recursive
obj <- get(name, pos = pos)
@@ -36,10 +42,11 @@
Group = typeof(obj),
Class = class(obj)[1],
Recursive = !inherits(obj, "function") && is.recursive(obj))
+ if (all.info) res <- c(Envir = pos, res)
return(res)
}
- res <- data.frame(t(sapply(Items, describe)),
- stringsAsFactors = FALSE)
+ res <- data.frame(t(sapply(Items, describe, pos = envir,
+ all.info = all.info)), stringsAsFactors = FALSE)
# Recalculate groups into meaningful ones for the object explorer
# 1) Correspondance of typeof() and group depicted in the browser
Modified: pkg/svMisc/R/objSearch.R
===================================================================
--- pkg/svMisc/R/objSearch.R 2008-06-05 15:15:11 UTC (rev 4)
+++ pkg/svMisc/R/objSearch.R 2008-06-05 20:21:44 UTC (rev 5)
@@ -4,7 +4,7 @@
if (compare) {
oldSearch <- getTemp(".guiObjSearchCache", default = "")
# Compare both versions
- if (length(Search) != length(oldSearch) || !all.equal(Search, oldSearch)) {
+ if (length(Search) != length(oldSearch) || !all(Search == oldSearch)) {
# Keep a copy of the last version in TempEnv
assignTemp(".guiObjSearchCache", Search)
Changed <- TRUE
Modified: pkg/svMisc/man/objBrowse.Rd
===================================================================
--- pkg/svMisc/man/objBrowse.Rd 2008-06-05 15:15:11 UTC (rev 4)
+++ pkg/svMisc/man/objBrowse.Rd 2008-06-05 20:21:44 UTC (rev 5)
@@ -7,7 +7,7 @@
\alias{objMenu}
\alias{objSearch}
-\title{ Function to implement an object browser }
+\title{ Functions to implement an object browser }
\description{
These functions provide features required to implement a complete object
browser in a GUI client.
@@ -20,7 +20,8 @@
objDir()
objInfo(id = "default", envir = .GlobalEnv, object = "", path = NULL)
objList(id = "default", envir = .GlobalEnv, object = "", all.names = FALSE,
- pattern = "", group = "", sep = "\t", path = NULL, compare = TRUE)
+ pattern = "", group = "", all.info = FALSE, sep = "\t", path = NULL,
+ compare = TRUE)
objMenu(id = "default", envir = .GlobalEnv, objects = "", sep = "\t",
path = NULL)
objSearch(sep = "\t", path = NULL, compare = TRUE)
@@ -42,19 +43,21 @@
\item{regenerate}{ Do we force to regenerate the information? }
\item{object}{ The currently selected object in the object browser }
\item{objects}{ A list with selected items in the object browser }
+ \item{all.info}{ Do we return all the information (envir as first column or
+ not (by default) }
\item{compare}{ If \code{compare == TRUE}, result is compared with last cached
value and the client is updated only if something changed }
}
\details{
- \code{objBrowse} do the horsework. \code{objDir} gets the temporary directory
+ \code{objBrowse()} does the horsework. \code{objDir()} gets the temporary directory
where exchange files are stored, in case you exchange data through files.
You can use a better way to communicate with your GUI (you have to provide
your code) and disable writing to files by using \code{path = NULL}.
- \code{objList} lists objects in a given environment.
- \code{objSearch} lists the search path.
- \code{objClear} clears any reference to a given object browser.
- \code{objInfo} computes a tooltip info for a given object.
- \code{objMenu} computes a context menu for selected object(s) in the object
+ \code{objList()} lists objects in a given environment.
+ \code{objSearch()} lists the search path.
+ \code{objClear()} clears any reference to a given object browser.
+ \code{objInfo()} computes a tooltip info for a given object.
+ \code{objMenu()} computes a context menu for selected object(s) in the object
explorer managed by the GUI client.
}
\value{
More information about the Sciviews-commits
mailing list