R/2_5_textTrainN.R
textTrainNPlot.Rd
(experimental) Plot cross-validated correlation coefficients across different sample-sizes from the object returned by the textTrainN function. If the number of cross-validations exceed one, then error-bars will be included in the plot.
textTrainNPlot(
tibble,
sample_percents = c(25, 50, 75, 100),
n_cross_val = 1,
x_unit = "percent",
y_range = NULL,
title = "Cross-validated correlation coefficients across different sample sizes",
x_axes_label = "Sample Size (percent)",
y_axes_label = "Correlation Coefficient (r)",
point_color = "#5dc688",
bar_color = "#60A1F7",
line_color = "grey",
bar_width = 1,
bar_size = 0.8,
line_size = 0.6,
line_type = "straight",
point_size = 3
)
(tibble) Object returned by the function textTrainN.
(numeric) Vector containing the percents of the total number of datapoints that is included in each sample (default = c(25,50,75,100)).
(numeric) Value of the number of times cross-validation has been repeated (default = 1, i.e., cross-validation has only been applied once).
(character, "percent" or "quantity") Determines whether the x-axis-values should represent the number of elements in each sample, or the number of percent of the total data they represent (default = "percent").
(numeric) Optional. Determines the y_range. E.g, y_range = c(1,2) sets the y_range from 1 to 2 (default = NULL).
(character) Determine plot title (default = "Cross-validated correlation coefficients across different sample sizes").
(character) Determine x-axis-label (default = "Sample Size (percent)").
(character) Determine y-axis-label (default = "Correlation Coefficient (r)").
(character, (Hex color codes)) Determine point color (default = "#5dc688").
(character, (Hex color codes)) Determine error-bar color (default = "#60A1F7").
(character, (Hex color codes)) Determine line color (default = "grey").
(numeric) Determine bar-width (default = 1).
(numeric) Determine bar-size (default = 1).
(numeric) Determine line-size (default = 1).
(character, either "straight" or "smooth") Determine line-type (default = "straight").
(numeric) Determine points size (default = 1).
A plot with correlation coefficient on y-axis and sample size in quantity or percent on x axis. If number och cross-validations exceed 1, then error bars measuring standard deviations will be plotted.
Example of a plot created by textTrainNPlot.
See textTrainN
.
# Plot cross-validated correlation coefficients across different sample-sizes from the object
# returned by the textTrainN function.
if (FALSE) {
plot_object <- textTrainNPlot(
tibble = tibble_to_plot,
n_cross_val = 3,
x_unit = "quantity"
)
# Visualize plot
plot_object
}