R Statistical software practice

how to create values

Data visualization

using histogram, boxplot, vioplot, bean plot and beeswarm

w<- c(20,21,22,23,24,25,26,27,28,29,30)
weight<- c(60,61,62,63,64,65,66,67,68,69,70)
library(EnvStats)
## 
## Attaching package: 'EnvStats'
## The following objects are masked from 'package:stats':
## 
##     predict, predict.lm
summaryFull(w)
##                              w      
## N                            11     
## Mean                         25     
## Median                       25     
## 10% Trimmed Mean             25     
## Geometric Mean               24.8   
## Skew                          0     
## Kurtosis                     -1.2   
## Min                          20     
## Max                          30     
## Range                        10     
## 1st Quartile                 22.5   
## 3rd Quartile                 27.5   
## Standard Deviation            3.317 
## Geometric Standard Deviation  1.144 
## Interquartile Range           5     
## Median Absolute Deviation     4.448 
## Coefficient of Variation      0.1327
library(psych)
describe(w)
##    vars  n mean   sd median trimmed  mad min max range skew kurtosis se
## X1    1 11   25 3.32     25      25 4.45  20  30    10    0    -1.53  1
describe(weight)
##    vars  n mean   sd median trimmed  mad min max range skew kurtosis se
## X1    1 11   65 3.32     65      65 4.45  60  70    10    0    -1.53  1
hist(w, col="green",xlab="age", ylab="frequency", 
     main = "Age of respondents")

boxplot(w, col="green",xlab="age", ylab="frequency", 
          main = "Age of respondents")

plot(density(w, xlab="age", ylab="Density",
             main="Density of repondents"))
## Warning: In density.default(w, xlab = "age", ylab = "Density", main = "Density of repondents") :
##  extra arguments 'xlab', 'ylab', 'main' will be disregarded
polygon(density(w, col="red"))
## Warning: In density.default(w, col = "red") :
##  extra argument 'col' will be disregarded

library(beeswarm)
beeswarm(w, col="green",xlab="age", ylab="frequency", 
           main = "Age of respondents")

library(vioplot)
## Loading required package: sm
## Package 'sm', version 2.2-6.0: type help(sm) for summary information
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
vioplot(w, col="green",xlab="age", ylab="frequency", 
          main = "Age of respondents")

library(beanplot)
beanplot(w, col="green",xlab="age", ylab="frequency", 
           main = "Age of respondents")