descriptives {r2spss} | R Documentation |
Descriptive Statistics
Description
Compute descriptive statistics of numeric variables of a data set (number of observations, minimum, maximum, mean, standard deviaiton). The output is printed as a LaTeX table that mimics the look of SPSS output.
Usage
descriptives(data, variables)
## S3 method for class 'descriptives_SPSS'
to_SPSS(object, digits = 2, ...)
## S3 method for class 'descriptives_SPSS'
print(x, version = r2spss_options$get("version"), ...)
Arguments
data |
a data frame containing the variables. |
variables |
a character vector specifying numeric variables for which to compute descriptive statistics. |
object , x |
an object of class |
digits |
an integer giving the number of digits after the comma to be printed in the SPSS table. |
... |
additional arguments to be passed down to
|
version |
a character string specifying whether the table should
mimic the look of recent SPSS versions ( |
Details
The print
method first calls the to_SPSS
method followed
by to_latex
. Further customization can be done by calling
those two functions separately, and modifying the object returned by
to_SPSS
.
Value
An object of class "descriptives_SPSS"
with the following components:
classes
a character vector giving the (first) class of the variables of interest.
descriptives
a data frame containing the descriptive statistics.
n
an integer giving the number of observations.
The to_SPSS
method returns an object of class "SPSS_table"
which contains all relevant information in the required format to produce
the LaTeX table. See to_latex
for possible components and
how to further customize the LaTeX table based on the returned object.
The print
method produces a LaTeX table that mimics the look of SPSS
output.
Note
LaTeX tables that mimic recent versions of SPSS (version = "modern"
)
may require several LaTeX compilations to be displayed correctly.
Author(s)
Andreas Alfons
Examples
# load data
data("Eredivisie")
# compute descriptive statistics for market value and age
descriptives(Eredivisie, c("MarketValue", "Age"))