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 to a name (e.g., 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).
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.
- Add a comment
#saying which ecoregion has the most moose browsing. Which ecoregion has the lowest?
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. 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.
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. HINT: Adapt the code from Question 12.
- 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. Remember to save the resulting summary table under a new name (E.g.,BalsamFir). 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. Remember to save the resulting summary table under a new name (e.g.,BlackSpruce).
- 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?
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? 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.