pdf("ex0105.pdf") # Read in data from ASCII formatted (Fixed With File) ex0105dat <- read.fwf("http://www.stat.ufl.edu/~winner/data/biostat/ex0105.dat", width=c(8), col.names=c("outcome")) # Create a categorical "factors" from smksts foutcome <- factor(ex0105dat$outcome,levels=1:5) levels(foutcome) = c("Cure", "Part Cure", "Ab Ext", "Ab Chng", "Death") # Create a dataset (frame) from input data ex0105 <- data.frame(ex0105dat, foutcome) # Attach the dataset for analysis attach(ex0105) # Give the frequencies for the categorical factor taboutcome <-table(foutcome) taboutcome # Make a histogram (vertical bar chart) of Outcome barplot(taboutcome) # Make a Pie Chart of Outcome pie(taboutcome) dev.off()