These functions are one of many R functions enabling users to assess variable descriptives. They have been developed to mimic SPSS' 'EXAMINE' syntax command ('Explore' in the menu) as closely as possible to ease the transition for new R users and facilitate teaching courses where both programs are taught alongside each other.

examine(
  ...,
  stem = TRUE,
  plots = TRUE,
  extremeValues = 5,
  qqCI = TRUE,
  conf.level = 0.95
)

# S3 method for examine
print(x, ...)

# S3 method for examine
pander(
  x,
  headerPrefix = "",
  headerStyle = "**",
  secondaryHeaderPrefix = "",
  secondaryHeaderStyle = "*",
  ...
)

examineBy(
  ...,
  by = NULL,
  stem = TRUE,
  plots = TRUE,
  extremeValues = 5,
  qqCI = TRUE,
  conf.level = 0.95
)

# S3 method for examineBy
print(x, ...)

# S3 method for examineBy
pander(
  x,
  headerPrefix = "",
  headerStyle = "**",
  secondaryHeaderPrefix = "",
  secondaryHeaderStyle = "*",
  tertairyHeaderPrefix = "--> ",
  tertairyHeaderStyle = "",
  separator = paste0("\n\n", repStr("-", 10), "\n\n"),
  ...
)

Arguments

...

The first argument is a list of variables to provide descriptives for. Because these are the first arguments, the other arguments must be named explicitly so R does not confuse them for something that should be part of the dots.

stem

Whether to display a stem and leaf plot.

plots

Whether to display the plots generated by the ufs::dataShape() function.

extremeValues

How many extreme values to show at either end (the highest and lowest values). When set to FALSE (or 0), no extreme values are shown.

qqCI

Whether to display confidence intervals in the QQ-plot.

conf.level

The level of confidence of the confidence interval.

x

The object to print or pander.

headerPrefix, secondaryHeaderPrefix, tertairyHeaderPrefix

Prefixes for the primary, secondary header, and tertairy headers

headerStyle, secondaryHeaderStyle, tertairyHeaderStyle

Characteers to surround the primary, secondary, and tertairy headers with

by

A variable by which to split the dataset before calling examine. This can be used to show the descriptives separate by levels of a factor.

separator

Separator for the result blocks.

Value

A list that is displayed when printed.

Details

This function basically just calls the descr function, optionally supplemented with calls to stem, ufs::dataShape().

Author

Gjalt-Jorn Peters

Maintainer: Gjalt-Jorn Peters gjalt-jorn@userfriendlyscience.com

Examples


### Look at the miles per gallon descriptives:
rosetta::examine(mtcars$mpg, stem=FALSE, plots=FALSE);
#> Descriptives for x
#> 
#>                 Mean :  20.09
#>   95% Conf. Interval :  [17.92; 22.26]
#>               Median :  19.20
#>                 Mode :  (multi)
#>             Variance :  36.32
#>   Standard Deviation :  6.03
#>              Minimum :  10.40
#>              Maximum :  33.90
#>             Skewness :  0.67
#>             Kurtosis : -0.02
#>             Dip test :  0.06
#>    Total sample size :  32
#>       Missing values :  0
#>    Valid sample size :  32
#> 
#> ###### Rows with lowest values:
#>    value
#> 15  10.4
#> 16  10.4
#> 24  13.3
#> 7   14.3
#> 17  14.7
#> 
#> ###### Rows with highest values:
#>    value
#> 26  27.3
#> 19  30.4
#> 28  30.4
#> 18  32.4
#> 20  33.9
#> 

### Separate for the different number of cylinders:
rosetta::examineBy(
  mtcars$mpg, by=mtcars$cyl,
  stem=FALSE, plots=FALSE,
  extremeValues=FALSE
);
#> ############################################################
#> 4
#> ############################################################
#> 
#> Descriptives for x
#> 
#>                 Mean :  26.66
#>   95% Conf. Interval :  [23.63; 29.69]
#>               Median :  26.00
#>                 Mode :  (multi)
#>             Variance :  20.34
#>   Standard Deviation :  4.51
#>              Minimum :  21.40
#>              Maximum :  33.90
#>             Skewness :  0.35
#>             Kurtosis : -1.43
#>             Dip test :  0.09
#>    Total sample size :  11
#>       Missing values :  0
#>    Valid sample size :  11
#> 
#> ############################################################
#> 6
#> ############################################################
#> 
#> Descriptives for x
#> 
#>                 Mean :  19.74
#>   95% Conf. Interval :  [18.4; 21.09]
#>               Median :  19.70
#>                 Mode :  21.00
#>             Variance :  2.11
#>   Standard Deviation :  1.45
#>              Minimum :  17.80
#>              Maximum :  21.40
#>             Skewness : -0.26
#>             Kurtosis : -1.83
#>             Dip test :  0.12
#>    Total sample size :  7
#>       Missing values :  0
#>    Valid sample size :  7
#> 
#> ############################################################
#> 8
#> ############################################################
#> 
#> Descriptives for x
#> 
#>                 Mean :  15.10
#>   95% Conf. Interval :  [13.62; 16.58]
#>               Median :  15.20
#>                 Mode :  (multi)
#>             Variance :  6.55
#>   Standard Deviation :  2.56
#>              Minimum :  10.40
#>              Maximum :  19.20
#>             Skewness : -0.46
#>             Kurtosis :  0.33
#>             Dip test :  0.07
#>    Total sample size :  14
#>       Missing values :  0
#>    Valid sample size :  14
#>