Description Usage Arguments Details Value Warning Author(s) See Also Examples
Prints out a simple summary of all the objects in the workspace
1 |
expand |
Should R "expand" data frames when listing variables? If |
The who
function prints out some basic information about all variables in the workspace. Specifically, it lists the names of all variables, what class they are, and how big they are (see below for specifics). If the expand
argument is TRUE
it will also print out the same information about variables within data frames. See the examples below to see what the output looks like.
The purpose for the function is to show more information than the objects
function (especially as regards the names of variables inside data frames), but not to show as much detail as the ls.str
function, which is generally too verbose for novice users.
The "size" of an object is only reported for some kinds of object: specifically, only those objects whose mode
is either numeric
, character
, logical
, complex
or list
. Nothing is printed for any other kind of object. If the object has explicit dimensions (e.g., data frames or matrices) then who
prints out the dimension sizes (e.g., "2 x 3" ). Otherwise the length of the object is printed.
who
returns an object of class whoList
which is just a data frame with a dedicated print method.
This package is under development, and has been released only due to teaching constraints. Until this notice disappears from the help files, you should assume that everything in the package is subject to change. Backwards compatibility is NOT guaranteed. Functions may be deleted in future versions and new syntax may be inconsistent with earlier versions. For the moment at least, this package should be treated with extreme caution.
Daniel Navarro
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | ### Example 1 ###
my.number <- 4
my.name <- "Dan"
# display the workspace:
who()
#
# -- Name -- -- Class -- -- Size --
# my.name character 1
# my.number numeric 1
#
### Example 2 ###
# create a data frame
dataset <- data.frame( hi = c( "hello","cruel","world" ),
pi = c( 3,1,4 ) )
# now display the workspace:
who()
#
# -- Name -- -- Class -- -- Size --
# dataset data.frame 3 x 2
# my.name character 1
# my.number numeric 1
#
# expand the data frame:
who( expand = TRUE )
#
# -- Name -- -- Class -- -- Size --
# dataset data.frame 3 x 2
# $hi factor 3
# $pi numeric 3
# my.name character 1
# my.number numeric 1
#
### Example 3 ###
# add a function to the workspace
quadruple <- function(x) { x*4 }
# add a formula to the workspace
my.formula <- blah ~ blah + blah
# now display the workspace:
who()
#
# -- Name -- -- Class -- -- Size --
# dataset data.frame 3 x 2
# my.formula formula
# my.name character 1
# my.number numeric 1
# quadruple function
#
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.