if (FALSE) {
# Create an Interval-Data object containing the Length, Diameter, Height, Whole weight,
# Shucked weight, Viscera weight (VW), and Shell weight (SeW) of 4177 Abalones,
# aggregated by sex and age.
# Note: The original micro-data (imported UCI Machine Learning Repository Abalone dataset)
# is given in the AbaDF data frame, and the corresponding values of the sex by age combinations
# is represented by the AbUnits factor.
AbaloneIdt <- AgrMcDt(AbaDF,AbUnits)
# Dispaly a plot of the Length versus the Whole_weight interval variables
plot(AbaloneIdt[,"Length"],AbaloneIdt[,"Whole_weight"])
plot(AbaloneIdt[,"Length"],AbaloneIdt[,"Whole_weight"],type="rectangles")
# Display the Abalone lengths using different colors to distinguish the Abalones age
# (measured by the number of rings)
# Create a factor with three levels (Young, Adult and Old) for Abalones with
# respectively less than 10 rings, between 11 and 18 rings, and more than 18 rings.
Agestrg <- substring(rownames(AbaloneIdt),first=3)
AbalClass <- factor(ifelse(Agestrg=="1-3"|Agestrg=="4-6"| Agestrg=="7-9","Young",
ifelse(Agestrg=="10-12"|Agestrg=="13-15"| Agestrg=="16-18","Adult","Old") ) )
plot(AbaloneIdt[AbalClass=="Young","Length"],col="blue",layout="horizontal")
plot(AbaloneIdt[AbalClass=="Adult","Length"],col="green",layout="horizontal",append=TRUE)
plot(AbaloneIdt[AbalClass=="Old","Length"],col="red",layout="horizontal",append=TRUE)
legend("bottomleft",legend=c("Young","Adult","Old"),col=c("blue","green","red"),lty=1)
}
Run the code above in your browser using DataLab