plot_r_squared: Plot R^2 (r-squared) values for a range of number of profiles

Description Usage Arguments Details Value Examples

Description

Plot R^2 (r-squared) values for a range of number of profiles

Usage

1
2
3
plot_r_squared(df, ..., to_center = FALSE, to_scale = FALSE,
  distance_metric = "squared_euclidean", linkage = "complete",
  lower_bound = 2, upper_bound = 9, r_squared_table = FALSE)

Arguments

df

with two or more columns with continuous variables

...

unquoted variable names separated by commas

to_center

(TRUE or FALSE) for whether to center the raw data with M = 0

to_scale

Boolean (TRUE or FALSE) for whether to scale the raw data with SD = 1

distance_metric

Distance metric to use for hierarchical clustering; "squared_euclidean" is default but more options are available (see ?hclust)

linkage

Linkage method to use for hierarchical clustering; "complete" is default but more options are available (see ?dist)

lower_bound

the smallest number of profiles in the range of number of profiles to explore; defaults to 2

upper_bound

the largest number of profiles in the range of number of profiles to explore; defaults to 9

r_squared_table

if TRUE, then a table, rather than a plot, is returned; defaults to FALSE

Details

Returns ggplot2 plot of cluster centroids

Value

A list containing a ggplot2 object and a tibble for the R^2 values

Examples

1
2
df <- mtcars
plot_r_squared(df, mpg, wt, hp, qsec, to_center = TRUE, lower_bound = 2, upper_bound = 4)

Example output

################################
Clustering data for iteration 2
Clustering data for iteration 3
Clustering data for iteration 4
################################
Warning messages:
1: Removed 3 rows containing missing values (geom_point). 
2: Removed 3 rows containing missing values (geom_path). 

prcr documentation built on May 2, 2019, 4:01 p.m.