Abstract:
We describe a set of S functions that will print an S object in its own window on the user's workstation. We discuss design issues in constructing the functions and relating the individual members of the set to each other and to the object-oriented paradigm in the underlying S program. We give several applications.
S, Display software, Object-oriented programming
> #X > options(window="X") > # X defaults to the xedit program for its display.
> print.display(my.data.frame)
> print.display(my.data.frame[,c(2,3,10:12,6)])
> my.data.frame <- data.frame(x=1:2, y=factor(c("a","b")), + q=structure(3:4, label="Z")) > my.data.frame x y q 1 1 a 3 2 2 b 4 > Vars(my.data.frame) Label Class Levels q Z x y factor a b
> V.my <- Vars(my.data.frame) > V.my
> options(window="Xsgi") > print.display(cars93[,c(11:15,1:10,16:26)], + X.flags="-font Courier8", width=280, title="cars93")
> form.page <- structure( + c(1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3), + names=names(my.data.frame), + form.dir="Study.R93.124")
> form <- function(question=1, form.page.arg=form.page, + sep="/", ...) + invisible(page(file= + paste(attr(form.page.arg,"form.dir"), + form.page.arg[question], sep=sep), + remove.file=F, ... ))
> form(12) # view the page with question 12 > form("cholesterol") # view the page with > # the "cholesterol" question
> form("cholesterol",page="xdvi") # TeX dvi file > form("cholesterol",page="ghostview") # PostScript file > form("cholesterol",page="xli") # Scanned image