Learn R Programming

dejaVu (version 0.3.1)

MakeDejaData: Create a DejaData object

Description

This object is can be used to create a SingleSim object with subject specific rates

Usage

MakeDejaData(data, arm, Id, rate = NULL)

Value

A DejaData object

Arguments

data

A data frame containing the subject

arm,

character the column name of the treatment arm for each subject

Id,

character the column name of subject Id

rate,

character the column name of the rate to be used when simulating (or NULL, if using DejaData to import a data set, see ImportSim)

Examples

Run this code

set.seed(232)

my.df <- data.frame(Id=1:100,
                    arm=c(rep(0,50),rep(1,50)),
                    covar=rbinom(n=100,size=1,prob=0.5))

my.df$rate <- 0.0025 + my.df$covar*0.002 + (1-my.df$arm)*0.002

my.dejaData <- MakeDejaData(my.df,arm="arm",rate="rate",Id="Id")

Run the code above in your browser using DataLab