Wednesday, May 12, 2010
S-plus Graphics
********************************************
Create S-plus Graphics including
**histogram
**x-y plot w/abline
**boxplot
********************************************
## Clear variables and load datasets ##
rm(list=objects())
data<-importData("Splusdata.csv", stringsAsFactors=F, sortFactorLevels=F)
##Data is organized by Group, Subject, Time, Time after Last Dose (TAD), and Concentration
## Plot Histogram of Concentration data ##
par(mar=c(6,6,2,2),mfrow=c(2,2))
hist(data$CONC, xlab="Concentration (ng/mL)", ylab="Frequency", col=16, cex=1.25)
## Scatter plot of Concentrations by Time ##
plot(1, 1, type="n",xlim = c(0,max(data$TIME)), ylim=c(0,max(data$CONC,na.rm=T)), xlab="Time (hr)", ylab="Concentration (ng/ml)", cex=1.25) points(data$TIME,data$CONC)
## Scatter plot of Concentration by TAD ##
plot(1, 1, type="n",xlim = c(0,max(data$TAD)),ylim=c(0,max(data$CONC,na.rm=T)), xlab="Time Since Last Dose (hr)", ylab="Concentration (ng/ml)", cex=1.25)
points(data$TAD,data$CONC)
lines(lowess(data$TAD,data$CONC),col=16,lwd=3)
## Box plots by treatment group ##
boxplot(data[data$GROUP==1,"CONC"],data[data$GROUP==2,"CONC"],
names=c("A","B"),xlab="Treatment Group",
ylab="Concentration (ng/ml)",boxcol=16,cex=1.25)
**************************************
1. Tutorial
Subscribe to:
Posts (Atom)