Abbreviation: db
Provides feedback regarding a data frame which includes the variable names, the dimensions of the resulting data frame, the data type for each variable, and the values of the variables in the data file for the first and last rows of the data. In addition, an analysis of missing data is provided, listing the number of missing values for each variable and for each observation.
details(data=mydata, n.mcut=1, miss.zero=FALSE, max.lines=30,
miss.show=30, miss.matrix=FALSE, brief=getOption("brief"))db(…, brief=TRUE)
Data frame for which to provide the details.
For the missing value analysis, list the row name and number of missing values if the number of missing exceeds or equals this cutoff.
For the missing value analysis, list the variable name or the row name even for values of 0. By default only variables and rows with missing data are listed.
Maximum number of lines to list of the data and labels.
For the missing value analysis, the number of rows, one row per observation,
that has as many or missing values as n.mcut
.
For the missing value analysis, if there is any missing data, list a version of the complete data table with a 0 for a non-missing value and a 1 for a missing value.
If TRUE
, display only variable names table plus any variable labels.
Further arguments to be passed to or from methods consistent
with the R read.table
function. For example, can set
stringsAsFactors
as TRUE
.
MISSING DATA
By default, details
provides a list of each variable and each row with the display of the number of associated missing values, indicated by the standard R missing value code NA. To not list the variable name or row name of variables or rows without missing data, invoke the miss.zero=FALSE
option, which can appreciably reduce the amount of output for large data sets. To view the entire data table in terms of 0's and 1's for non-missing and missing data, respectively, invoke the miss.matrix=TRUE
option.
VARIABLE LABELS
Standard R does not provide for variable labels, but lessR
does. Variable labels can be provided for some or all of the variables in the data frames. One way to enter the variable labels is to read them from their own file with details
with labels
set to the full path name or URL
of the labels file, or just the file name if the labels file is in the same directory as the data file. Another method is to include the labels directly in the data file. To to this, specify the file of variable labels with the label="row2"
option. The web survey application Qualtrics downloads csv
files in this format.
For a file that contains only labels, each row of the file, including the first row, consists of the variable name, a comma, and then the label, that is, standard csv
format such as obtained with the csv
option from a standard worksheet application such as Microsoft Excel or LibreOffice Calc. Not all variables in the data frame that contains the data, usually mydata
, need have a label, and the variables with their corresponding labels can be listed in any order. An example follows.
I2,This instructor presents material in a clear and organized manner. I4,Overall, this instructor was highly effective in this class. I1,This instructor has command of the subject. I3,This instructor relates course materials to real world situations.
If there is a comma in the variable label, then the label needs to be enclosed in quotes.
The lessR
functions that provide analysis, such as Histogram
for a histogram, automatically include the variable labels in their output, such as the title of a graph. Standard R functions can also use these variable labels by invoking the label
function, such as setting main=label(I4)
to put the variable label for a variable named I4 in the title of a graph.
Read
.
# NOT RUN {
# read the built-in data set datEmployee
# this provides an automatic call to details
mydata <- Read("Employee", in.lessR=TRUE)
# manually request the details for mydata
details()
# manually request just variable names, labels for mydata
db()
# }
Run the code above in your browser using DataLab