Exploratory data analysis using DescTools Package in R
Exploratory data analysis (EDA) is an approach to analyzing data to summarize their main characteristics, often with visual methods. The DescTools package provides functions for generating histograms, boxplots, and other visualizations to explore data.
Example 1: To generate a scatterplot with marginal densities with PlotMarDens() function:
Syntax : PlotMarDens(x, y, grp = 1, xlim = NULL, ylim = NULL, col = rainbow(nlevels(factor(grp))), mardens = c("all","x","y"), pch = 1, pch.cex = 1, main = "", args.legend = NULL, args.dens = NULL, ...)
Parameters:
- x: numeric vector of x values.
- y: numeric vector of y values (of same length as x).
- grp: grouping variable(s), typically factor(s), all of the same length as x.
- xlim: the x limits of the plot.
- ylim: the y limits of the plot.
- col: the colors for lines and points. Uses rainbow() colors by default.
R
x <- rnorm (100) y <- rnorm (100) # Create the scatterplot with marginal densities PlotMarDens ( y, x, grp=1 , xlab= "delivery_min" , ylab= "temperature" , col= SetAlpha ( "brown" , 0.4) , pch=15, lwd=3 , panel.first= grid (), args.legend= NA , main= "GeekforGeeks" ) |
Output:
Desctools Package in R
The DescTools package in R programming is a collection of functions that are used in various scenarios where data description, summary, and exploration are needed. It is a widely used package that was designed to help data scientists, researchers, and data analyst to understand their data and identify their findings.
The DescTools package comes with a wide range of functions that can be used in the program to understand the data better with the help of visualization. It is basically used for generating descriptive statistics, histograms, boxplots, scatterplots, and density plots. It also provides functions for calculating measures of central tendency, dispersion, correlation, and regression analysis.