5 Part II: Tree Sapling Study
In this section we will be working with the SaplingStudy dataset. We are giving you less code here; but many of the tasks are similar to what you just completed in Part One. Your task is to adapt the code given above to these new datasets and questions.
Dataset Overview: A team of researchers at MUN went to each ecoregion and sampled all the different tree saplings that grew that year. The goal of this study was to see if moose have browsing preference on sapling species. For each tree they recorded
The height of the tree (cm)
The moose browsing intensity: With 0 being no browsing by moose and 5 meaning severe browsing.
Question 11
a. Load the data file: SaplingStudy.csv and save your dataset as saplings.
- Then remove the
NAs from the dataset usingna.omit()function. Remember to save the cleaned version of your dataset to a new name (or override the old name). Save assap_clean.
Question 12
a. How does moose browsing pressure vary across different ecoregions? With the help of pipes %>%, create a new database using the group_by() function to group the data by Ecoregion, and then use summarize() to calculate the mean() moose BrowsingScore for each site. Print the result using the print() function. Save the result as sap_reg_browse. HINT: Remember to use your cleaned dataset from the question above.
- Which ecoregions have the highest and lowest amount of moose browsing? Rearrange your dataset in order of decreasing average browsing score
AverageBrowsing. Save the result asavg_browse_reg. Add a short comment#indicating which regions had the highest and lowest average browsing scores.
Question 13
How does the average tree height vary across different ecoregions? With the help of pipes
%>%, use thegroup_byfunction to group the data byEcoregion, and then usesummarize()to calculate themean()treeHeightfor each group. Print the result using theprint()function. Save the result assap_reg_height. HINT: Adapt the code from Question 12 above.The team considered average heights less than 20 cm to be severely browsed by moose. Add a short comment
#to describe which ecoregions have average heights less than 20 cm. Do this by looking at your data or using a filter(). Print the result using theprint()function. Save the result assap_reg_height_low.
Question 14
a) How does the average browsing score vary across different tree sapling species? Use the group_by function to group the data by Species, and then use summarize() tocalculate the mean tree BrowsingScore for each group. Print the result using the print() function. Save the result as sap_spe_browse. HINT: Adapt the code from Question 12.
- Which species have the highest and lowest browsing? Rearrange the data according to decreasing mean browsing score. Save the rearranged results as
avg_browse_spe. Add a comment#saying which species has the highest browsing score, which species has the lowest?
Question 15
A team of researchers in interested in how Balsam Fir browsing intensity varies by ecoregion. With the help of pipes %>%, use the filter() function to filter the Species column for only Balsam_Fir, then use group_by() function to sort by Ecoregion , and then determine mean() moose BrowsingScore. Save the resulting summary table as fir_reg_browse. HINT: Adapt the code from Question 12 above.
Question 16
Using the BalsamFir dataset you created in Question 15, make a bar graph the barplot() function. Each bar should represent an ecoregion, and the height of the bar should reflect the average browsing intensity.
Follow the template below and replace the placeholder names with the appropriate column names from your dataset.
barplot(Dataset$YAxisColumn, names.arg = Dataset$XAxisColumn, xlab = "X-axis name goes here", ylab = "Y-axis name goes here", main = "Figure title goes here", col = "forestgreen", #pick any colour you want cex.names = 0.6) # Reduces x-axis label size for readability
Question 17
How does Black Spruce browsing intensity varies by ecoregion? Repeat the steps from question 15 and 16 but now with Black Spruce.
- With the help of pipes, use the
filter()function to filter theSpeciescolumn for onlyBlack_Spruce, then usegroup_by()function to sort byEcoregion, and then determinemean()mooseBrowsingScore. Save the resulting summary table asspruce_reg_browse.
- Using the dataset you just created, make a bar graph the
barplot()function to show the Average browsing score for Black Spruce across the ecoregions. Each bar should represent an ecoregion, and the height of the bar should reflect the average browsing intensity
- How does Black Spruce browsing compare to Balsam Fir browsing across ecoregions? Write 1-2 sentences as a comment
#with your answer.
Question 18
Were the same number of tree saplings counted in each Ecoregion?
Add a line of code where you use the group_by() function and the tally() function to determine how many trees were counted in each Ecoregion. Save the result as sap_reg_tally.
Question 19
Were the same number of tree saplings counted for each species? Add a line of code where you use the tally() function to determine how many individual trees were counted in for each Species. Save the result as sap_spe_tally. HINT: Adapt the code from Question 18 above.
Question 20
In any ecological study, it’s important to ask whether the dataset accurately reflects the system you’re trying to understand. In this question, you’ll evaluate whether sampling bias may be affecting your interpretation of moose browsing patterns.
a. Add a short comment # saying if you think the SaplingStudy dataset is evenly distributed. Are any ecoregion(s) or tree species overrepresented, are any underepresented in the dataset.
b. Why is it important to recognize bias in ecological datasets. Write 1-2 sentences as a comment # with your answer.