variableDataEditing: Editing variable files from add*() functions

Description Usage Arguments Details Value Examples

View source: R/addVariables.R

Description

This function will edit column names of the file gotten from add*() function. It will append column names from crea.rep dataset first, and then customly add the names of the new column(s), depending on which file are you editing (BP, BMI or diabetes). It will also add the "formerge" column where it creates a identifier for merging. This column is created by simply pasting PatientID, event.date and CodeValue of the variable file.

Usage

1
2
variableDataEditing(crea.dataset, variable.data = variable.data,
  BPtype = NULL, toedit = c("BP", "BMI", "diabetes"))

Arguments

crea.dataset

dataset with creatinine ReadCodes, at least three creatinine measurements per patient.

variable.data

bmi, diabetes or blood pressure data gotten from one of the add*() functions in the package.

BPtype

a character string. E.g. "diastolic" or "systolic", or simply "D" and "S". How ever you type it, it will be converter to upper case. Default is NULL

toedit

A vector. Can be "BP", "BMI" or "diabetes". This will tell the function which file editing you want to do.

Details

If toedit="BP", you have to specify BPtype ("diastolic" or "systolic"). This will create a edited BP dataframe - it renames last two columns to BP code value and "Flag". Regardless of what you chose in the "toedit", function will also add the "formerge" column created for the purposes of merging all the variables to the final file. I suggest saving the final files as RDS (saveRDS(editeddiastolicfile, "path/to/file.rds")), as it uses less space and loads faster. The column used for time analysis is named "event.time".

Value

it returns a edited crea-BMI, crea-diabetes, crea-diastolic BP or crea-systolic BP data frame.

Examples

1
2
3
4
5
## Not run: 
editeddiastolicfile <- variableDataEditing(crea.rep, crea_dia.txt, BPtype="diastolic", toedit="BP")
editedBMIfile <- variableDataEditing(crea.rep, crea_dia.txt, toedit="BMI")

## End(Not run)

dkurtoic/addVariables documentation built on May 30, 2019, 8:28 a.m.