Practical Statistics – 4

Truth of the matter is I’m burnt out on this set. I suppose there is more that can be done with it but I ain’t gonna do it.

Before I walk away from it I wanted to do one more distribution chart, soil type by area – Functionally. Before I had a big ‘ol loop to do it for me. This time with subsets It’s down to a ‘handful’ of lines, and graphed.



SmallTreeData <- read.csv("/home/Daiten/R/Project_1/covtype.csv")
Area_Subset <- subset(SmallTreeData, SmallTreeData$Wilderness_Area4=="1")  #change wilderness area
count_vector <- c()
xaxis <- seq(1:36)
yaxis <- seq(1:20000)

for(e in xaxis)
{
  fragment1 <- paste("soil_count <- nrow(subset(Area_Subset, Area_Subset$Soil_Type", e, "==1))", sep="")
  assign(paste("Soil_Type", e, sep=""), eval(parse(text=fragment1)))
}

for(i in xaxis)
{
  fragment2 <- paste("Soil_Type", i, sep="")
  count_vector <- cbind(count_vector, eval(parse(text=fragment2)))
}

barplot(count_vector, col="darkmagenta", names.arg=xaxis, ylim=c(0, 150000), main="Instances of Soil Type for Reagion Four")

Leave a Reply

Your email address will not be published. Required fields are marked *