rk.get.tempfile.name {rkward}R Documentation

RKWard file names

Description

In RKWard the output is saved as a html file which is located at "~/.rkward" by default. (TODO: make this platform free). The name of this html file can be retrieved and set using rk.get.output.html.file and rk.set.output.html.file. rk.flush.output.html.file will delete the current (or specified) html file, and re-initialize it.

Usage

  rk.get.tempfile.name(prefix = "image",
    extension = ".jpg")

  rk.get.workspace.url()

  rk.get.output.html.file()

  rk.set.output.html.file(x,
    additional.header.contents = getOption("rk.html.header.additions"))

  rk.flush.output(x = rk.get.output.html.file(),
    flush.images = TRUE, ask = TRUE)

Arguments

prefix

a string, used as a filename prefix when saving images to the output file

extension

a string, used as a filename extension when saving images to the output file

x

a string, giving the filename of the of the output file

additional.header.contents

NULL or an additional string to add to the HTML header section. This could be scripts or additional CSS definitions, for example. Note that

flush.images.

If true, any images used in the output file will be deleted as well.

ask

Logical: Whether to ask before flushing the output file.

Details

rk.get.tempfile.name returns a non-existing filename inside the directory of the output file. It is mainly used by rk.graph.on to create filenames suitable for storing images in the output. The filenames of the temporary files are of the form "prefixxyz.extension". rk.get.tempfile.name is somewhat misnamed. For truly temporary files, tempfile is generally more suitable.

rk.get.workspace.url returns the url of workspace file which has been loaded in RKWard, or NULL, if no workspace has been loaded. NOTE: This value is note affected by running load in R, only by loading R workspaces via the RKWard GUI.

Value

rk.get.tempfile.name, rk.get.output.html.file, and rk.get.workspace.url return a string while rk.set.output.html.file returns NULL.

Author(s)

Thomas Friedrichsmeier rkward-devel@lists.sourceforge.net

See Also

rkward://page/rkward_output, tempfile, file, rk.print

Examples

testfile.name <- rk.get.tempfile.name(prefix="test", extension=".txt")
testfile <- file(testfile.name)
cat("This is a test\n", file=testfile)
close(testfile)
unlink(testfile.name)

outfile <- rk.get.output.html.file()

## Not run
rk.set.output.html.file("~/.rkward/another_file.html")
rk.header("Output on a different output file")
rk.show.html(rk.get.output.html.file())
rk.flush.output()
rk.set.output.html.file(outfile)

[Package rkward version 0.6.1 Index]