Theophylline

Data Sets

Info

Original Form

Original Data Set

Download theophylline (Original)
> head(theophylline)
  ID  AMT TIME    DV WEIGHT
1  1 4.02 0.00    NA   79.6
2  1 4.02 0.25  2.84   79.6
3  1 4.02 0.57  6.57   79.6
4  1 4.02 1.12 10.50   79.6
5  1 4.02 2.02  9.66   79.6
6  1 4.02 3.82  8.58   79.6

Massage Data

Changes that NEED to be made

Final Form

Download theophylline (Final)(Source the file)
> head(theophylline)
  ID DOSE TIME    DV WEIGHT MDV  AMT
1  1 4.02 0.00    NA   79.6   1 4.02
2  1 4.02 0.25  2.84   79.6   0 0.00
3  1 4.02 0.57  6.57   79.6   0 0.00
4  1 4.02 1.12 10.50   79.6   0 0.00
5  1 4.02 2.02  9.66   79.6   0 0.00
6  1 4.02 3.82  8.58   79.6   0 0.00

Code

Code to alter Theophylline to fit the requests above

theophylline <- read.csv(file.choose())		### theophylline.txt

theophylline <- cbind(theophylline,0,0)		### Due to not having a MDV and DOSE column

col.name <- colnames(theophylline)
colnames(theophylline) <- c(col.name[1],"DOSE",col.name[3:5],"MDV","AMT")		### Rename columns

theophylline[is.na(theophylline["DV"]),"MDV"] <- 1
theophylline[is.na(theophylline["DV"]),"AMT"] <- theophylline[is.na(theophylline["DV"]),"DOSE"]

theophylline