The relsa_levels function calculates kmeans-based RELSA levels based on a reference data set.

relsa_levels(
  refset,
  mypath,
  filename = NULL,
  bsl = bsl,
  drops = NULL,
  turns = NULL,
  relsaNA = NA,
  k = 4,
  showScree = "no",
  customCol = NULL,
  seed = 123,
  myYlim = c(0, 1.4),
  showPlot = "no",
  saveTiff = "no"
)

Arguments

refset

normalized data from a reference set

mypath

path specification for saving clustering outputs

filename

filename for the output *.tiff

bsl

baseline object from relsa_baselines function

drops

character vector of variables to drop

turns

variables with inverted development under severity (i.e. temperature might rise or drop depending on the actual animal model)

relsaNA

codes how to handle NaN values during calculations (default is NA)

k

the number of k clusters (user defined, default is 4)

showScree

show the Scree plot to estimate the optimal number of clusters

customCol

custom color string for the k clusters

seed

random seed, if set to NULL, no seeding for kmeans is used

myYlim

limits of the y-axis for the clustering

showPlot

shows the ordered data and colored cluster levels

saveTiff

yes/no whether to save the output as *.tiff file (if no, mypath is obsolete)

Value

levels data.frame with k+1 levels determined by k-means