1 / 3

Vegetation Analysis

Vegetation Analysis. Exercise 1 Answers. ## 1.1 Calculate the total basal area by species. Show a bar plot of the sorted values. spbatot <- apply( spba , 2, sum) barplot (sort( spbatot ), cex.names =0.5)

Download Presentation

Vegetation Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Vegetation Analysis

  2. Exercise 1 Answers ## 1.1 Calculate the total basal area by species. Show a bar plot of the sorted values. spbatot <- apply(spba, 2, sum) barplot(sort(spbatot), cex.names=0.5) ## 1.2 Calculate the average basal area per plot by species. Hint: use the table created from 1.1 and the sppres table. Show a bar plot of the sorted values with labels. sppres## Display sppres spbaavg<- round(spbatot / sppres, 2)## Average basal area for each species barplot(sort(spbaavg), cex.names=0.5, main="Avg basal area by species", xlab="Species", ylab="Avg basal area per plot") ## 1.3 Compare the barplot of avg basal area per plot with the barplot of avg number of trees per plot. Do not sort tables. Show on the same page and label plots. Hint: use par(mfrow). par(mfrow=c(2,1)) barplot(spbaavg, cex.names=0.5, main="Avg basal area per plot by species", xlab="Species", ylab="Avg basal area per plot") barplot(spavg, cex.names=0.5, main="Avg number of trees per plot by species", xlab="Species", ylab="Avgnumber of trees per plot") ## 1.4 Which species has the highest basal area per plot? Utah juniper ## 1.5 Which species has the highest number of trees per plot? mahogany

  3. Exercise 1 Answers ## 1.6 Append the spba table to the plt table, naming the new object plt3. Change any NA values to 0 values. Make sure all records of plt are included. plt3 <- merge(plt, spba, by.x="CN", by.y="row.names", all.x=TRUE) head(plt3) dim(plt3) spnames<- colnames(spba) plt3[,spnames][is.na(plt3[,spnames])] <- 0 # Change NA values to 0 head(plt3) ## 1.7 Append the totba vector to the plt3 data frame, keeping plt3 as the name. Change any NA values in new column to 0 values. Make sure all records of plt3 are included. totba.df<- data.frame(totba) plt3 <- merge(plt3, totba.df, by.x="CN", by.y="row.names", all.x=TRUE) head(plt3) dim(plt3) plt3[,"totba"][is.na(plt3[,"totba"])] <- 0 # Change NA values to 0 head(plt3) ## 1.8 Merge the species-level tables created in 1.1 and 1.2 (spbatot, spbaavg) to the sptab table. sptab is.vector(spbatot) is.vector(spbaavg) spbatot.df <- data.frame(spbatot) spbaavg.df<- data.frame(spbaavg) sptab <- merge(sptab, spbatot.df, by.x="Species", by.y="row.names") sptab <- merge(sptab, spbaavg.df, by.x="Species", by.y="row.names") sptab

More Related