checkDataUpload: General check function for user-uploaded data

View source: R/checks.R

checkDataUploadR Documentation

General check function for user-uploaded data

Description

This is used in dataUploadServer. Checks for (in this order):

  1. exactly one ID column, which is by default converted to character

  2. actual data columns besides ID

  3. all data columns are numeric

When all of the above pass without issues, the function returns a named list with data contained in result and NULL contained in message, otherwise it witholds the data by returning NULL for result and message will contain a character vector of the issue(s) noted. If the downstream use for data requires different check steps and transformations, this function can be replaced as long as the new one uses the same return structure. For some cases, if it is desired that we return data even if there are issues, use result = data and rely on the message output.

Usage

checkDataUpload(data, result = NULL, idcol = "ID", idchar = TRUE, html = TRUE)

Arguments

data

A data.table.

result

What to return in place of data if issues are found with the data. Defaults to NULL.

idcol

Name of expected ID column, defaulting to "ID".

idchar

Logical with default TRUE, for whether to convert idcol to character.

html

(Not used) Logical with default TRUE, for whether to format message with HTML for display.

Value

A list with result and message. See details.


avucoh/DIVE documentation built on Aug. 29, 2023, 6:02 p.m.