ggplot
to create more polished
exploratory graphsThis week, we will focus on polishing and expanding our existing
graphs to draft our preliminary results to share with Pasa and the
Bionutrient Institute. We will focus especially on building capacity to
adjust graphs in ggplot
for effective data visualization
for an external audience. You will continue working with a combined
dataset that includes the Pasa and Bionutrient Institute datasets.
results = "hide"
to show the code but not the output in the
final documentDavis_et_al_2004_clean.csv
in Posit Cloud).fun = median
to sort by the median value)You will only turn in one .Rmd file for your entire group - that said, please work in parallel so that everyone stays engaged. You can ‘divide and conquer’ by dividing up the different nutrients to figure out what values to annotate. Decide with your group who will turn in the ‘final’ version.
Lab_06_Draft_report_I
)
PS 6: Distributions
File
-> Save As
06_ps_Crop.Rmd
. (replacing
Crop with the name of your crop)##
for main headings###
for subheadingstidyverse
using library()
RColorBrewer
using library()
combined_clean.csv
) using
read.csv()
str()
summary()
filter()
to include only your
crop and store it as a new dataframeThis section should contain six total graphs - one for each nutrient. They should each have their own chunk and be listed in a particular order (for consistency across the report):
The goal of the graph is to show the distribution of nutrient values for your crop in the Pasa and Bionutrient Institute datasets and compare them to reference values. Adapt the example code to create each graph. Each one should meet these criteria:
geom_jitter
, colored
by organization, using the Dark2
color scale from R Color
Brewer. Make points semi-transparent using alpha = 0.6.Calcium (mg per 100 g)
with
the correct units (see data dictionary linked above)#8C8C8C
(dark gray) for annotations + adjust
year labels for clarity if lines are close.theme_light
)fig.height = 2.5
in the chunk options to make the
graphs the same size.Look at your final graphs together. What patterns do you see? Summarize the important take-home messages in a short paragraph. Some questions to consider:
This next section will be completed individually. You will work on one type of graph - to be determined with your group. The three types of graphs that are needed are:
- Relationship of nutrient density to crop variety (variety)
- Relationship of nutrient density to soil status (soil status)
- Variability in management practices (management)
Lab_06_Draft_report_I
)
PS 6:
and either
Variety
, Soil status
, or
Management
File
-> Save As
06_ps_Crop_Graph-type.Rmd
.
(replacing Crop with the name of your crop and graph type with either
Variety
, Soil status
or
Management
)##
for main headings###
for subheadingstidyverse
using library()
RColorBrewer
using library()
combined_clean.csv
) using
read.csv()
str()
summary()
filter()
to include only your
crop and store it as a new dataframeWork with the other folks creating the same type of graph to use a consistent format. This will allow our report and presentation to be visually cohesive and easier to understand.
This section should contain six total graphs - one for each nutrient. They should each have their own chunk and be listed in a particular order (for consistency across the report):
The goal of the graph is to show the distribution of nutrient values across varieties for your crop in the Pasa and Bionutrient Institute datasets. Adapt the example code from Problem Set 4 to meet the following criteria:
Calcium (g per 100 g)
with
the correct units (see data dictionary linked above)theme_light
)Look at your final graphs for your crop. What patterns do you see? Summarize the important take-home messages in a short paragraph. Some questions to consider:
List the citation (APA format) for at least one source that informed your interpretation.
Work with the other folks creating the same type of graph to use a consistent format. This will allow our report and presentation to be visually cohesive and easier to understand. Everyone should use soil organic matter as your X variable (this was the most popular choice in the last dataset and is widely regarded as a holistic measure of soil health). Decide as a group whether to use organic matter in the top 10 cm of soil or the variable
om_percent
. I suggest checking which variable has more data in the two datasets.
This section should contain six total graphs - one for each nutrient. They should each have their own chunk and be listed in a particular order (for consistency across the report):
The goal of the graph is to explore the relationship of soil status to nutrient density. We will explore whether soil organic matter is related to nutrient density for your crop in the Pasa and Bionutrient Institute datasets. Adapt the example code from Problem Set 4 to meet the following criteria:
mediumpurple
and deeppink
Calcium (g per 100 g)
with
the correct units (see data dictionary linked above)% organic matter (0-10 cm)
theme_light
)fig.height = 3.5
and fig.width = 6
Look at your final graphs for your crop. What patterns do you see? Summarize the important take-home messages in a short paragraph. Some questions to consider:
List the citation (APA format) for at least one source that informed your interpretation.
Work with the other folks creating the same type of graph to use a consistent format. This will allow our report and presentation to be visually cohesive and easier to understand. Make sure you are using the same words/labels to refer to the different management practices.
This section should contain six total graphs - one for each management practice. They should each have their own chunk and be listed in a particular order (for consistency across the report):
The goal of the graph is to explore how much data is available to look at the influence of each management practice. Adapt the example code provided in today’s Posit Cloud project to meet the following criteria:
# of observations
#d95f02
and #1b9e77
width = 0.5
theme_light
)fig.height = 2
to set a consistent
sizeLook at your final graphs for your crop. What patterns do you see? Summarize the important take-home messages in a short paragraph. Some questions to consider:
List the citation (APA format) for at least one source that informed your interpretation.
Knit your R Markdown files using the Knit
button at the
top of the code editor. This is a good check on whether your analysis is
reproducible!
To access your file, navigate to the Files
tab in the
lower right window. Find the .html file for your problem set and click
the box next to it. Navigate to More
–>
Export
to download the file. It will likely go to your
downloads folder.
Examine the file closely to make sure that it knitted correctly and contains all parts of your problem set. If you need to make revisions, you can simply revise your code and then knit it again.
Submit BOTH the .html
file
AND the .Rmd
file for each analysis:
sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.4
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/New_York
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] workflowr_1.7.1
loaded via a namespace (and not attached):
[1] vctrs_0.6.5 httr_1.4.7 cli_3.6.2 knitr_1.45
[5] rlang_1.1.3 xfun_0.41 stringi_1.8.3 processx_3.8.3
[9] promises_1.2.1 jsonlite_1.8.8 glue_1.7.0 rprojroot_2.0.4
[13] git2r_0.33.0 htmltools_0.5.7 httpuv_1.6.13 ps_1.7.5
[17] sass_0.4.8 fansi_1.0.6 rmarkdown_2.25 jquerylib_0.1.4
[21] tibble_3.2.1 evaluate_0.23 fastmap_1.1.1 yaml_2.3.8
[25] lifecycle_1.0.4 whisker_0.4.1 stringr_1.5.1 compiler_4.3.2
[29] fs_1.6.3 pkgconfig_2.0.3 Rcpp_1.0.12 rstudioapi_0.15.0
[33] later_1.3.2 digest_0.6.34 R6_2.5.1 utf8_1.2.4
[37] pillar_1.9.0 callr_3.7.3 magrittr_2.0.3 bslib_0.6.1
[41] tools_4.3.2 cachem_1.0.8 getPass_0.2-4