numeric_only: Filters REDCap records data for numeric data only

View source: R/numeric_only.R

numeric_onlyR Documentation

Filters REDCap records data for numeric data only

Description

Unless a vector of variables/field names is passed to the fields argument, the fields to be analyzed will be guessed based on column type. Furthermore, all non-numeric data will be removed before analysis. If mixed numeric/non-numeric data (e.g. "160 cm") are passed, the first numerical instance will be extracted from the data. A long format dataframe is returned.

This is an internal function only.

Usage

numeric_only(
  record_data,
  data_dict = getOption("redcap_bundle")$data_dict,
  sex_var = NA,
  fields = NULL,
  long_format = TRUE,
  drop_message = TRUE
)

Arguments

record_data

Dataframe. Records data export from REDCap. For the purposes of this function, only quantitative data will be kept.

data_dict

Dataframe. REDCap project data data_dictionary. By default, $data_dict is expected in the REDCap bundle option, as created by rc_bundle.

sex_var

String. Name of variable indicating the sex of subjects. If included, it will be used as one of the melting factors.

fields

Character. A vector of field/variable names to be analyzed may be passed manually.

long_format

Logical. Determines whether the returned dataframe will be in long or wide format. Default is TRUE.

drop_message

Logical. Determine if a message is shown to the user about dropping non-numerical data

Author(s)

Marcus Lehr


chillywings/rctools documentation built on Aug. 9, 2024, 11:52 p.m.