resid_plot | R Documentation |
Function for creating plots and tables for residual values from observed and estimated values.
resid_plot(
df,
obs,
...,
type = "scatterplot",
point_size = 3,
color = NA,
nrow = NA,
ncol = NA,
lim_y = NA,
xlab = "Observed values",
clab = NA,
font = "serif",
legend_pos = "bottom",
gray_scale = TRUE,
res_table = FALSE
)
df |
A data frame. |
obs |
Quoted name of the observed values variable. |
... |
Quoted name(s) for the estimated values variable(s). Multiple variables must be separated by comma. |
type |
Character object for the type of plot created, The available plots are: |
point_size |
Numeric value for the point size in scatter plots. Default: |
color |
Quoted name of a variable. If supplied, this variable will be used to classify the data by color. Default: |
nrow |
Numeric value for number of rows in the plot matrix. If not supplied, the plots will be automatically sorted. Default: |
ncol |
Numeric value for number of columns in the plot matrix. If not supplied, the plots will be automatically sorted. Default: |
lim_y |
Numeric value for the y axis upper and lower limit. If |
xlab |
Character value for the x label used in some plots. Default: |
clab |
Character value for the color label used, if a color variable is supplied. If not supplied, the |
font |
Type of font used in the plot. Default: |
legend_pos |
Position of legend, when a color variable is supplied. This can either be |
gray_scale |
If |
res_table |
If |
A ggplot object, or, if res_table = TRUE
, a data frame.
Sollano Rabelo Braga sollanorb@gmail.com
library(forestmangr)
data("exfm11")
head(exfm11)
# Specifying the observed and estimated variables, we get a scatter plot
# for the percentage residuals:
resid_plot(exfm11, "TH", "TH_EST1")
# It's possible to get other types of plots, with the type argument:
resid_plot(exfm11, "TH", "TH_EST1", type = "histogram_curve")
resid_plot(exfm11, "TH", "TH_EST1", type = "versus")
# It's possible to add a factor variable as color in the plots:
resid_plot(exfm11, "TH", "TH_EST1", "TH_EST2", color="STRATA",
xlab="Total Height (m)", clab="Strata", gray_scale=FALSE)
# If there are more estimated values variables, they can also be used
# in the comparison:
resid_plot(exfm11, "TH", "TH_EST1", "TH_EST2", "TH_EST3")
# It's possible to rearrange the plots with ncol and nrow:
resid_plot(exfm11, "TH", "TH_EST1", "TH_EST2", "TH_EST3", ncol=1)
# It's possible to get the residuals table used to generate these plots, with res_table=TRUE:
head( resid_plot(exfm11, "TH", "TH_EST1", "TH_EST2", res_table = TRUE) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.