Learn R Programming

lessR (version 2.2)

values: List the values of a Variable

Description

List the values of a variable from the global environment or a data frame.

Usage

values(x, dframe=mydata, ...)

Arguments

x
Variable for which to construct the histogram and density plots.
dframe
Data frame that contains the variable of interest, default is mydata.
...
Other parameter values for as defined processed by print, including digits.

Details

Provided for listing the values of a variable in an unattached data frame. All lessR functions that access data for analysis from a data frame, such as the default mydata provided by the rad function that reads the data frame from an external data file, do not require the data frame to be attached. Attaching a data frame can lead to some confusing issues, but one negative of not attaching is that simply listing the name of a variable within the data frame leads to an 'object not found' error. The values function provides access to that variable within a data frame just as is true for any other lessR function that accesses data.

The function displays the values of the specified variable with the standard R print function, so parameter values for print can also be passed to values.

See Also

print

Examples

Run this code
# generate 10 random normal data values
Y <- rnorm(10)
mydata <- data.frame(Y)
rm(Y)

# list the values of Y
values(Y)

# variable of interest is in a data frame which is not the default mydata
# access the breaks variable in the R provided warpbreaks data set
# although data not attached, access the variable directly by its name
data(warpbreaks)
values(breaks, dframe=warpbreaks)

Run the code above in your browser using DataLab