restore_missing_values: Restore missing values for dataframe

View source: R/restore_missing_values.R

restore_missing_valuesR Documentation

Restore missing values for dataframe

Description

Restore missing values (numeric instead of NA) as defined in formats file for all variables in the dataframe.

Usage

restore_missing_values(
  df,
  formats_df = formats,
  post_dm = FALSE,
  omit_labelled = FALSE,
  var_selection = c("_all")
)

Arguments

df

dataframe

formats_df

dataframe defining the formats. Must be in standard format containing columns Variable_name, Value_Label_1-x. If needed run function read_formats_xlsx.R beforehand.

post_dm

Logical; if FALSE, all variables are added as part of data management steps defined as "not imported" in column Import_format of the formats file will be omitted.

omit_labelled

Logical; if TRUE, all variables that are already labelled, will be omitted. Default is omit_tagged = FALSE, so that all previously labelled variables will be tagged again.

var_selection

Character vector of selected variables to be set missing. Default var_selection = c("all") means that all variables are selected.

Value

dataframe


marianschmidt/msAutolabelR documentation built on April 17, 2022, 7:42 a.m.