Learn R Programming

text (version 1.2.0)

textTrainNPlot: (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.

Description

(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.

Usage

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
)

Value

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.

Arguments

tibble

(tibble) Object returned by the function textTrainN.

sample_percents

(numeric) Vector containing the percents of the total number of datapoints that is included in each sample (default = c(25,50,75,100)).

n_cross_val

(numeric) Value of the number of times cross-validation has been repeated (default = 1, i.e., cross-validation has only been applied once).

x_unit

(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").

y_range

(numeric) Optional. Determines the y_range. E.g, y_range = c(1,2) sets the y_range from 1 to 2 (default = NULL).

title

(character) Determine plot title (default = "Cross-validated correlation coefficients across different sample sizes").

x_axes_label

(character) Determine x-axis-label (default = "Sample Size (percent)").

y_axes_label

(character) Determine y-axis-label (default = "Correlation Coefficient (r)").

point_color

(character, (Hex color codes)) Determine point color (default = "#5dc688").

bar_color

(character, (Hex color codes)) Determine error-bar color (default = "#60A1F7").

line_color

(character, (Hex color codes)) Determine line color (default = "grey").

bar_width

(numeric) Determine bar-width (default = 1).

bar_size

(numeric) Determine bar-size (default = 1).

line_size

(numeric) Determine line-size (default = 1).

line_type

(character, either "straight" or "smooth") Determine line-type (default = "straight").

point_size

(numeric) Determine points size (default = 1).

Plot Example

Example of a plot created by textTrainNPlot.

See Also

See textTrainN.

Examples

Run this code
# 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
}

Run the code above in your browser using DataLab