inspect: Check for common errors in multi-environment trial data

inspectR Documentation

Check for common errors in multi-environment trial data

Description

[Stable]

inspect() scans a data.frame object for errors that may affect the use of functions in metan. By default, all variables are checked regarding the class (numeric or factor), missing values, and presence of possible outliers. The function will return a warning if the data looks like unbalanced, has missing values or possible outliers.

Usage

inspect(.data, ..., plot = FALSE, threshold = 15, verbose = TRUE)

Arguments

.data

The data to be analyzed

...

The variables in .data to check. If no variable is informed, all the variables in .data are used.

plot

Create a plot to show the check? Defaults to FALSE.

threshold

Maximum number of levels allowed in a character / factor column to produce a plot. Defaults to 15.

verbose

Logical argument. If TRUE (default) then the results for checks are shown in the console.

Value

A tibble with the following variables:

  • Variable The name of variable

  • Class The class of the variable

  • Missing Contains missing values?

  • Levels The number of levels of a factor variable

  • Valid_n Number of valid n (omit NAs)

  • Outlier Contains possible outliers?

Author(s)

Tiago Olivoto tiagoolivoto@gmail.com

Examples


library(metan)
inspect(data_ge)

# Create a toy example with messy data
df <- data_ge2[-c(2, 30, 45, 134), c(1:5)] %>% as.data.frame()
df[c(1, 20, 50), 5] <- NA
df[40, 4] <- "2..814"

inspect(df)


metan documentation built on March 7, 2023, 5:34 p.m.