gg_crosstab2: [!] Plot crosstab for 2 variables in hyperSpec object

View source: R/gg_crosstab2.R

gg_crosstab2R Documentation

[!] Plot crosstab for 2 variables in hyperSpec object

Description

[!] Plot crosstab for 2 variables in hyperSpec object

Usage

gg_crosstab2(
  sp,
  x_var,
  y_var,
  xLabel = labels(sp, x_var),
  yLabel = labels(sp, y_var),
  ID_var = "ID",
  rotate.x.tick.labels = NULL,
  useNA = "ifany"
)

Arguments

sp

hyperSpec object.

x_var,

y_var names of variables inside sp, that contain information to be crosstabulated.

xLabel,

yLabel labels for variables x_var, y_var respectively.

ID_var

name of variable inside sp, that contain ID of sample.

rotate.x.tick.labels

Determine if x axis tick labels should be rotated in 45 degrees angle (to avoid overlapping). Possible valued TRUE, FALSE or NULL (default, rotate if maximum length of x tick label is more that 3 symbols).

useNA

whether to include NA values in the table. See ‘Details’. Can be abbreviated.

Value

2 ploted crosstabs: first for number of medical samples, second for number of spectra.

Examples

library(spHelper)

gg_crosstab2(Spectra2,"gr","class", ID_var = NULL)


Spectra2$gr3<- c("a123", "b123")
gg_crosstab2(Spectra2,"gr3","class", ID_var = NULL)


GegznaV/spHelper documentation built on April 16, 2023, 1:42 p.m.