Learn R Programming

analyzer (version 1.0.1)

explainer.numeric: Explain method for numeric data types

Description

This is a explainer method for numeric vector.

Usage

# S3 method for numeric
explainer(
  X,
  xname = NULL,
  include.numeric = NULL,
  round.digit = 2,
  quant.seq = seq(0, 1, 0.2),
  trim = 0.05,
  ...
)

Arguments

X

a numeric (or integer) data type

xname

a placeholder for variable name

include.numeric

a vector having strings which is also required along with the default output. Can have values:

  • trimmed.means for printing the trimmed mean after removing trim fraction of data from each side of x. trim can be passed as an parameter

  • skewness for printing the skewness of the data. Use ?skreness for more information

  • kurtosis for printing the kurtosis of the data. Use ?kurtosis for more information

round.digit

number of decimal places required in the output.

quant.seq

vector of fractions (0 to 1) for which the quantiles are required 0.5 means median, 0 means smallest observation and 1 means largest observation

trim

the fraction (0 to 0.5) of observations to be trimmed from each end of x before the mean is computed. Values of trim outside that range are taken as the nearest endpoint. This only works if include.numeric has a string 'trimmed.means'

...

other parameters required

Value

Prints the following information on console:

  • vector name

  • type

  • number of distinct values

  • number of missing values

  • mean

  • sd (standard deviation)

  • median

  • quantiles based on quant.seq parameter

  • other information based on include.numeric

  • a box plot (only if number distinct numbers are > 2). If counts of all the factor levels are less than half of length of x, then the histogram is scaled with maximum of 50 ?consoleBoxplot for how to read the table and histogram)

  • a frequency table and histogram (only if number of distinct numbers are < 11) (look at ?freqTable for how to read the table and histogram)

Details

This method removes all the missing values in x before computing the summaries.

Examples

Run this code
# NOT RUN {
explainer(mtcars$mpg)
explainer(mtcars$mpg, include.numeric = c('trimmed.means', 'skewness',
'kurtosis'), round.digit = 1, quant.seq = seq(0,1,0.1), trim = 0.05)

# }

Run the code above in your browser using DataLab