pinktoe {pinktoe} | R Documentation |
Pinktoe converts a S tree object to a set of HTML and perl files that can be, once uploaded to a perl-aware web server, interactively traversed by a user with a web browser. This is useful for large trees or trees where the variables require description by verbose text.
pinktoe(treeobj, textfn, tittext, treeid = "", cgibindir = paste("/~magpn/cgi-bin/", treeid, "/", sep = ""), htmldir = paste("/home/magpn/public_html/Research/Politics/TREE/", treeid, "/", sep = ""), localdir = "Tree/", stateprintfn = partyprint, requirelib = "../party.lib", commonhtml)
treeobj |
An object of class rpart (or tree in S) |
textfn |
A user supplied function that prints out text to a file in response to a variable name. |
tittext |
A user supplied function that prints out title text to a file in response to a variable name |
treeid |
This is a character string which is appended to both
cgibindir and htmldir .
This can be useful when you are building
web pages for a collection of trees and store different trees in
separate directories. |
cgibindir |
A character string containing the directory where the perl
files generated by pinktoe (with the extension .pl ) will be
stored.
(This should be the directory part of the URL of the cgi-bin
directory). |
htmldir |
A character string containing the directory where the HTML
files generated by pinktoe (with the extension .htm )
will be stored. (This should be a pathname understood and
able to be found by perl).
|
localdir |
A local location to store both the HTML and perl files immediately after they are generated |
stateprintfn |
A user-supplied function that decides what to do when
supplied with the yval reached at the leaf of a tree. Some
text can be output, or maybe a perl function call. |
requirelib |
A library of perl functions that can be called by, e.g.
stateprintfn . The library that this refers to
should reside in the cgibin directory. If no function calls
are planned then it doesn't matter what argument is supplied. |
commonhtml |
A user-supplied function that prints out some HTML code. This is appended to every HTML web page. |
See the example below for usage. See http://www.stats.bris.ac.uk/~magpn/Research/Pinktoe/Welcome.html for a full description
No value is produced.
This is version 2, an earlier version didn't work well with R
Guy P Nason
http://www.stats.bris.ac.uk/~magpn/Research/Pinktoe/Welcome.html
# # Attach rpart library # library("rpart") data("mpincdf99") # # Create a tree (rpart object) # z.edm <- makeEDMtree() # # Plot the tree to see its basic structure. # plot(z.edm) text(z.edm) # # Now use pinktoe to generate a set of htm and pl files that can be used # by a CGI-enabled web server to traverse the tree. # data("edmbigtext") # # Next code requires "sfsmisc" library. This is not installed by default # in R distributions so you'll have to get it yourself. We make sure # that the next code doesn't run because R CMD check can't install packages (I think) # ## Not run: pinktoe(z.edm, edm.text, partytittext, treeid="", localdir="./", cgibindir="/~magpn/cgi-bin/TEST/", htmldir="/home/magpn/public_html/TEST/", stateprintfn=partyprint, requirelib="../party.lib", commonhtml=partycommonhtml) ## End(Not run) # Frame row number is 1 # Node number is 1 # Frame row number is 2 # Node number is 2 # Frame row number is 3 # Node number is 4 # Frame row number is 4 # Node number is 8 # Frame row number is 6 # Node number is 17 # Frame row number is 7 # Node number is 34 # Frame row number is 8 # Node number is 68 # Frame row number is 9 # Node number is 136 # Frame row number is 17 # Node number is 3 # # If you look in the current directory you'll find a load of perl and # HTML files created. #