| rk.results {rkward} | R Documentation |
Various utilty functions which can be used to print or export R objects to the (html) output file. The output file can be accessed from Windows -> Show Output. Basically, these functions along with the ones described in rk.get.label, rk.get.tempfile.name, and rk.graph.on can be used to create a HTML report.
rk.print(x, ...) rk.print.literal(x) rk.header(title, parameters = list(), level = 1) rk.results(x, titles = NULL) rk.describe.alternative(x)
x |
any R object to be printed/exported. A suitable list in case of rk.describe.alternative. |
title |
a string, used as a header for the html output |
level |
an integer, header level. For example, level=2 creates the header with <h2></h> tag. |
parameters |
a list, preferably named, giving a list of "parameters" to be printed to the output |
titles |
a character vector, giving the column headers for a html table. |
rk.print prints/exports the given object to the output (html) file using the HTML function. This requires the R2HTML package. Additional arguments in ... are passed on to HTML.
rk.print.literal prints/exports the given object using a paste(x, collapse="\n") construct to the output (html) file.
rk.header prints a html header, possibly with parameters, to the output file. See example.
rk.results is similar to rk.print but prints in a more tabulated fashion. This has been implemented only for certain types of x: tables, lists (or data.frames), and vectors. See example.
rk.describe.alternatives describes the alternative (H1) hypothesis of a htest. This is similar to stats:::print.htext and makes sense only when x$alternatives exists.
rk.describe.alternatives returns a string while all other functions return NULL, invisibly.
Thomas Friedrichsmeier rkward-devel@lists.sourceforge.net
HTML, rk.get.output.html.file, rk.get.description, rk.call.plugin, rkward://page/rkward_output
require (rkward)
require (R2HTML)
## see the output: Windows->Show Output
## stolen from the two-sample t-test plugin ;)
local({
x1 <- rnorm (100)
x2 <- rnorm (100, 2)
nm <- rk.get.description (x1,x2)
result <- t.test (x1, x2, alternative="less")
rk.header (result$method,
parameters=list ("Comparing", paste (nm[1], "against", nm[2]),
"H1", rk.describe.alternative (result),
"Equal variances", "not assumed"))
rk.print.literal ("Raw data (first few rows):")
rk.print (head (cbind (x1,x2)), align = "left")
rk.print.literal ("Test results:")
rk.results (list (
'Variable Name'=nm,
'estimated mean'=result$estimate,
'degrees of freedom'=result$parameter,
t=result$statistic,
p=result$p.value,
'confidence interval percent'=(100 * attr(result$conf.int, "conf.level")),
'confidence interval of difference'=result$conf.int ))
})