xyboxplot {datana} | R Documentation |
Creates a scatterplot with superposing boxplots
Description
The function creates a scatterplot with superposing boxplots for the Y-axis variable. To a simple scatterplot between the response variable 'y' and the predictor variable 'x', this function superposes boxplots of the response by groups of the predictor variable. The main aim of the above described graph is to get a sense of the distribution of the response variable depending upon the predictor variable.
Usage
xyboxplot(x = x, y = y, col.dots = "blue", xlab = NULL, ylab = NULL)
Arguments
x |
A numeric vector representing the time variable (X-axis). |
y |
A numeric vector representing the response variable (Y-axis). |
col.dots |
(optional) A string specifying the dot colors. Default is "blue". |
xlab |
(optional) A string specifying X-axis label. |
ylab |
(optional) A string specifying Y-axis label. |
Details
Notice that the superposing boxplots for the Y-axis variable are computed by grouping the X-axis variable in 10 classes. Those classes are set by computing the ten percentiles of the X-axis variable, therefore each group has the same number of observations.
Value
The function returns the above described graph.
Author(s)
Christian Salas-Eljatib
References
- Salas-Eljatib C. 2021. Análisis de datos con el programa estadístico R: una introducción aplicada. Ediciones Universidad Mayor. Santiago, Chile. https://eljatib.com
- Salas C, Stage AR, and Robinson AP. 2008. Modeling effects of overstory density and competing vegetation on tree height growth. Forest Science 54(1):107-122. doi:10.1093/forestscience/54.1.107
Examples
data(fishgrowth)
df <- fishgrowth
xyboxplot(x=df$age,y=df$length)
xyboxplot(x=df$age,y=df$length)