descplot {dataprep} | R Documentation |
View the descriptive statistics via plot
Description
It applies to an original (a raw) data and produces a plot to describe the data with 9 statistics including n, na, mean, sd, median, trimmed, min, max, and IQR.
Usage
descplot(data, start = NULL, end = NULL, stats= 1:9, first = "variables")
Arguments
data |
A data frame to describe, from the column |
start |
The column number of the first variable to describe. |
end |
The column number of the last variable to describe. |
stats |
Selecting or rearranging the items from the 9 statistics, i.e., n, na, mean, sd, median, trimmed, min, max, and IQR. It can be a vector or a single value, in 'character' or 'numeric' class. |
first |
The name of the first column of the output. It is the general name of the items (variables). |
Details
This function will describe the data first using descdata. Then, A plot to show the result will be produced using the package ggplot2
(coupled with self-defined melt
or reshape2::melt
to melt the intermediate data). The variables from start
to end
need to be linked together instead of being scattered.
Value
A plot to show the descriptive result of the data, including:
size |
default general name of items (variables). Users can define it via the parameter |
n |
number of valid cases |
na |
number of invalid cases |
mean |
mean of each item |
sd |
standard deviation |
median |
median of each item |
trimmed |
trimmed mean (with trim defaulting to .1) |
min |
minimum of each item |
max |
maximum of each item |
IQR |
interquartile range of each item |
Author(s)
Chun-Sheng Liang <liangchunsheng@lzu.edu.cn>
References
1. Example data is from https://smear.avaa.csc.fi/download. It includes particle number concentrations in SMEAR I Varrio forest.
2. Wickham, H. 2007. Reshaping data with the reshape package. Journal of Statistical Software, 21(12):1-20.
3. Wickham, H. 2009. ggplot2: Elegant Graphics for Data Analysis. http://ggplot2.org: Springer-Verlag New York.
4. Wickham, H. 2016. ggplot2: elegant graphics for data analysis. Springer-Verlag New York.
See Also
dataprep::descdata
and dataprep::melt
Examples
# Line plots for variable names that are essentially numeric
descplot(data,5,65)
# Use numbers to select statistics
descplot(data,5,65,c(2,7:9))
# Use characters to select statistics
descplot(data,5,65,c('na','min','max','IQR'))
# Bar charts for type of variable names that is character
descplot(data1,3,7)
# Use numbers to select statistics
descplot(data1,3,7,7:9)
# Use characters to select statistics
descplot(data1,3,7,c('min','max','IQR'))