Learn R Programming

PK (version 1.3-6)

Glucose: Baseline adjusted glucose levels following alcohol ingestion

Description

The Glucose data frame has 196 rows and 4 columns. The dataset is originally in package nlme as Glucose2.

Arguments

Format

This data frame contains the following columns:

id

a factor with levels 1 to 7 identifying the subject whose glucose level is measured.

date

a factor with levels 1 2 indicating the occasion in which the experiment was conducted.

time

a numeric vector giving the time since alcohol ingestion (in min/10).

conc

a numeric vector giving the blood glucose level (in mg/dl) adjusted for baseline.

Details

Hand and Crowder (Table A.14, pp. 180-181, 1996) describe data on the blood glucose levels measured at 14 time points over 5 hours for 7 volunteers who took alcohol at time 0. The same experiment was repeated on a second date with the same subjects but with a dietary additive used for all subjects.

Dataset was corrected for baseline using the following code:

## dataset Glucose2 of package nlme
require(nlme)
Glucose2 <- Glucose2[order(Glucose2$Subject, Glucose2$Date, Glucose2$Time),]
## adjust for pre-infusion levels measured at time points -1 and 0
data <- NULL
for(i in unique(Glucose2$Subject)){
  for(j in unique(Glucose2$Date)){
     temp <- subset(Glucose2, Subject==i & Date==j)
     temp$Conc <- temp$glucose - mean(c(temp$glucose[1], temp$glucose[2]))
     temp$Conc <- ifelse(temp$Conc < 0 | temp$Time <= 0, 0, temp$Conc)
     ## handle intermediate values > 0 
     index1 <- which.max(temp$Conc)
     index2 <- which.min(temp$Conc[-c(1:index1)]) + index1
     if(temp$Conc[index2]==0){temp$Conc[c(index2:nrow(temp))] <- 0}
     data <- rbind(data,temp)
   }
}    
Glucose <- subset(data, Time >= 0, 
                  select=c('Subject', 'Date', 'Time', 'Conc'))
names(Glucose) <- c("id","date","time","conc")