[rkward-cvs] SF.net SVN: rkward:[3073] trunk/rkward/rkward

kapatp at users.sourceforge.net kapatp at users.sourceforge.net
Sat Sep 25 06:12:50 UTC 2010


Revision: 3073
          http://rkward.svn.sourceforge.net/rkward/?rev=3073&view=rev
Author:   kapatp
Date:     2010-09-25 06:12:49 +0000 (Sat, 25 Sep 2010)

Log Message:
-----------
Rd for rk.call.plugin. Added rk.list.plugins to public.R, but it needs improvement.

Modified Paths:
--------------
    trunk/rkward/rkward/pages/rkward_public_functions.rkh
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
    trunk/rkward/rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkward/man/rk.results.Rd

Modified: trunk/rkward/rkward/pages/rkward_public_functions.rkh
===================================================================
--- trunk/rkward/rkward/pages/rkward_public_functions.rkh	2010-09-23 22:15:43 UTC (rev 3072)
+++ trunk/rkward/rkward/pages/rkward_public_functions.rkh	2010-09-25 06:12:49 UTC (rev 3073)
@@ -16,7 +16,7 @@
 
 	<section title="Other functions" id="public_fns">
 	<ul>
-		<li>Call plugins: <link href="rkward://rhelp/rk.call.plugin"/>.</li>
+		<li>Call or list plugins: <link href="rkward://rhelp/rk.call.plugin"/>.</li>
 		<li>Various editing (object and files) related functions are documented here: <link href="rkward://rhelp/rk.edit"/>.</li>
 		<li>Various output and results related functions are documented here: <link href="rkward://rhelp/rk.results"/>.</li>
 		<li>Various labels and names related functions are documented here: <link href="rkward://rhelp/rk.get.label"/>.</li>

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2010-09-23 22:15:43 UTC (rev 3072)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2010-09-25 06:12:49 UTC (rev 3073)
@@ -371,6 +371,28 @@
 	invisible (TRUE)
 }
 
+# list all available plugins in RKWard; this is a companion function for rk.call.plugin:
+# the output provides possible strings for "plugin" argument in rk.call.plugin
+rk.list.plugins <- function (path, type = "all") {
+	# Need a better way to get path and not have the user provide it
+	# path = /usr/share/kde4/apps/rkward, ~/.kde/share/apps/rkward, ...
+	if (missing (path) || !file.exists (path)) stop ("Wrong path")
+	
+	if (type == "all") type <- "*"
+	
+	pnm <- NULL
+	for (fname in list.files (path, paste (type, "pluginmap", sep = "."))) {
+		con <- file (file.path (path, fname), "r", blocking = FALSE)
+		.L. <- readLines (con)
+		close (con)
+		.L. <- .L.[grepl ("<component ", .L., fixed = TRUE)]
+		.L. <- .L.[grepl ("id=", .L., fixed = TRUE)]
+		if (length (.L.) > 0)
+			pnm <- c(pnm, sapply (strsplit (sapply (strsplit(.L., "id=\"", fixed = TRUE), "[[",2), "\" "), "[[", 1))
+	}
+	pnm
+}
+
 # a wrapper around chooseCRANmirror() without changing options ("repos"), permanently
 "rk.select.CRAN.mirror" <- function () {
 	old_repos <- getOption("repos")

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd	2010-09-23 22:15:43 UTC (rev 3072)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd	2010-09-25 06:12:49 UTC (rev 3073)
@@ -1,28 +1,58 @@
 \name{rk.call.plugin}
 \alias{rk.call.plugin}
+\alias{rk.list.plugins}
 
-\title{TODO}
+\title{Call or list built-in RKWard plugin(s)}
 
 \description{
 }
 
 \usage{
 rk.call.plugin(plugin, ..., submit.mode = c("manual", "auto", "submit"))
+rk.list.plugins(path, type = "all")
 }
 
 \arguments{
+\item{plugin}{character string, giving the name of the plugin to call. This is of the form "\code{rkward::}\emph{plugin_name}". See Details.}
+\item{\dots}{arguments passed to the \code{plugin}}
+\item{submit.mode}{character string, specifying the submission mode: \code{"manual"} will open the plugin GUI and wait for the user to submit it manually, \code{"submit"} will submit the plugin to the output, or \bold{TODO: _check me_} \code{"auto"} will use the built-in default of the plugin (which in most cases will be same as \code{"submit"}).}
+\item{path}{character string, giving the directory to search for various pluginmap files. This is the directory where the KDE application, "RKWard," is installed (and not the R package, "rkward"). For example, on most Debian based Linux systems this is generally \code{/usr/share/kde4/apps/rkward} or \code{~/.kde/share/apps/rkward}.}
+\item{type}{character string, giving the specific pluginmap file to scan. Currently suported strings are \code{"all"}, \code{"analysis"}, \code{"data"}, \code{"distributions"}, \code{"import_export"}, \code{"irt"}, \code{"plots"}, and \code{"x11device"}. The default value of \code{"all"} scans all pluginmap files.}
 }
 
 \details{
+\code{rk.call.plugin} provides a high level wrapper to call any plugin available in RKWard. The exact string to be used as \code{plugin} is generally not transparent to the user. Use \code{rk.list.plugins} to list these. A particular character string (\emph{plugin_name}) thus obtained needs to be prefixed by \code{"rkward::"} for a valid \code{plugin} argument. See example.
+
+\code{rk.list.plugins} scans the given pluginmap file and lists all the available plugins under it. 
 }
 
 \value{
-  Returns \code{TRUE} invisibly.
+\code{rk.call.plugin} returns \code{TRUE} invisibly.
+
+\code{rk.list.plugins} returns a character vector of plugin names. If none found, \code{NULL} is returned. 
 }
 
 \author{Thomas Friedrichsmeier \email{rkward-devel at lists.sourceforge.net}}
 
+\seealso{
+\code{\link{rk.results}}, \url{rkward://page/rkward_output} 
+}
+
 \examples{
+## list all analysis related plugins
+rk.list.plugins ("~/.kde/share/apps/rkward", "analysis")
+
+## "t_test_two_vars" plugin:
+## see the output: Windows->Show Output
+local({
+x1 <- rnorm (100)
+x2 <- rnorm (100, 2)
+
+rk.call.plugin ("rkward::t_test_two_vars", 
+  confint.state="1", conflevel.real="0.95", hypothesis.string="greater", paired.state="0", varequal.state="0", 
+  x.available="x1", y.available="x2", 
+  submit.mode="submit")
+})
 }
 
 \keyword{utilities}

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/man/rk.results.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/man/rk.results.Rd	2010-09-23 22:15:43 UTC (rev 3072)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/man/rk.results.Rd	2010-09-25 06:12:49 UTC (rev 3073)
@@ -46,7 +46,7 @@
 \author{Thomas Friedrichsmeier \email{rkward-devel at lists.sourceforge.net}}
 
 \seealso{
-\code{\link{HTML}}, \code{\link{rk.get.output.html.file}}, \code{\link{rk.get.description}}, \url{rkward://page/rkward_output}
+\code{\link{HTML}}, \code{\link{rk.get.output.html.file}}, \code{\link{rk.get.description}}, \code{\link{rk.call.plugin}}, \url{rkward://page/rkward_output} 
 }
 
 \examples{


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list