Learn R Programming

exceldata (version 0.1.1.3)

createCalculated: Create calculated variables

Description

This function will create survival and recoded variables according to the rules in the dictionary.xlsm file. See the Example sheet for an example.

Usage

createCalculated(data, dictionary, timeUnit = "month")

Value

A data frame with the calculated variables as specified by the dictionary

Arguments

data

A data frame data returned by the importExcelData or readExcelData functions

dictionary

A data frame returned by the importExcelData or readDataDict functions

timeUnit

String containing the desired unit of time for survival variables

Examples

Run this code
if (FALSE) {
exampleDataFile <- system.file("extdata", "exampleData.xlsx", package = "exceldata")
dictionary <- readDataDict(exampleDataFile, dictionarySheet = 'DataDictionary')
data <- readExcelData(exampleDataFile,dictionary,dataSheet='DataEntry')
factorData <- addFactorVariables(data,dictionary,keepOriginal = TRUE)
fullData <- createCalculated(factorData,dictionary,timeUnit='month')
}

Run the code above in your browser using DataLab