| 1 |
\name{view} |
| 2 |
\alias{view} |
| 3 |
\alias{viewPrep} |
| 4 |
\alias{viewPrep.default} |
| 5 |
\alias{viewPrep.data.set} |
| 6 |
\alias{viewPrep.data.frame} |
| 7 |
\alias{viewPrep.descriptions} |
| 8 |
\alias{viewPrep.codeplan} |
| 9 |
\alias{viewPrep.importer} |
| 10 |
\title{A Generic Viewing Function} |
| 11 |
\description{ |
| 12 |
The function \code{view} provides generic interface to the non-generic |
| 13 |
function \code{View}. |
| 14 |
|
| 15 |
In contrast to the implementation of \code{View} provided by either |
| 16 |
basic \emph{R} or \emph{RStudio}, this function can be extended to |
| 17 |
handle new kinds of objects by defining \code{viewPrep} methods for |
| 18 |
them. Further, \code{view} can be adapted to other GUIs by specifying |
| 19 |
the \code{"vfunc"} option or the \code{vfunc=} optional argument. |
| 20 |
|
| 21 |
Internally, \code{view} usues the generic function \code{viewPrep} |
| 22 |
to prepare data so it can be passed on to the (non-generic) function |
| 23 |
\code{View} or (optionally) a different graphical user interface |
| 24 |
function that can be used to display matrix- or data frame-like |
| 25 |
objects. |
| 26 |
|
| 27 |
The \code{vfunc} argument determines how the result of \code{viewPrep} |
| 28 |
is displayed. Its default is the function \code{View}, but an |
| 29 |
alternative is \code{\link{view_html}} which creates and displays an HTML grid. |
| 30 |
} |
| 31 |
\usage{ |
| 32 |
view(x, |
| 33 |
title=deparse(substitute(x)), |
| 34 |
vfunc=getOption("vfunc","View"), |
| 35 |
\dots) |
| 36 |
|
| 37 |
# The internal generic, not intended to be used by the end-user. |
| 38 |
viewPrep(x,title,\dots) |
| 39 |
\method{viewPrep}{data.set}(x,title,\dots) |
| 40 |
\method{viewPrep}{data.frame}(x,title,\dots) |
| 41 |
\method{viewPrep}{descriptions}(x,title,\dots) |
| 42 |
\method{viewPrep}{codeplan}(x,title,compact=FALSE,\dots) |
| 43 |
\method{viewPrep}{importer}(x,title,compact=TRUE,\dots) |
| 44 |
} |
| 45 |
\arguments{ |
| 46 |
\item{x}{an object, e.g. a data frame, data.set, or importer. |
| 47 |
} |
| 48 |
\item{title}{an optional character string; shown as the title of the |
| 49 |
display.} |
| 50 |
\item{vfunc}{a character string; a name of a GUI function to call |
| 51 |
with the results of \code{viewPrep()}} |
| 52 |
\item{compact}{a logical value; should the codeplan be shown in a |
| 53 |
compact form - one line per variable - or in a more expanive form - |
| 54 |
one line per labelled value?} |
| 55 |
\item{\dots}{further arguments; \code{view()} passes them on to |
| 56 |
\code{viewPrep}.} |
| 57 |
} |
| 58 |
\examples{ |
| 59 |
\dontrun{ |
| 60 |
example(data.set) |
| 61 |
view(Data) |
| 62 |
view(description(Data)) |
| 63 |
view(codeplan(Data)) |
| 64 |
# Note that this file is *not* included in the package |
| 65 |
# and has to be obtained from GESIS in order to run the |
| 66 |
# following |
| 67 |
ZA7500sav <- spss.file("ZA7500_v2-0-0.sav") |
| 68 |
view(ZA7500sav) |
| 69 |
} |
| 70 |
} |