Skip to content

Commit ff2c45b

Browse files
author
Leah Wasser
committed
more text fixes
1 parent 1d27415 commit ff2c45b

File tree

11 files changed

+112
-214
lines changed

11 files changed

+112
-214
lines changed

_posts/course-materials/earth-analytics/week-1/intro-knitr-rmd/2016-12-06-Rmd01-why-rmarkdown.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ data, code (methods used to process the data) and outputs. We will use the
7272
`rmarkdown` and `knitr` package to write R Markdown files in `Rstudio` and
7373
publish them in different formats (html, pdf, etc).
7474

75-
## Open Science Slideshow
75+
### Open Science Slideshow
7676

7777
Click through the slideshow below to learn more about open science.
7878
<a class="btn btn-info" href="{{ site.baseurl }}/slide-shows/share-publish-archive/" target= "_blank"> <i class="fa fa-youtube-play" aria-hidden="true"></i>
@@ -99,15 +99,32 @@ underlying R code or data changes)."
9999
We use R Markdown (.rmd) files to document workflows and to share data processing,
100100
analysis and visualization code & outputs.
101101

102-
## RMD is beneficial to your colleagues
102+
## Why R Markdown?
103+
There are many advantages to using R Markdown in your work:
104+
105+
* **Human readable:** it's much easier to read a web page or a report containing text and figures.
106+
* **Simple syntax:** markdown and `rmd` can be learned quickly.
107+
* **A Reminder for Your Future Self** All components of your work are clearly documented. You don't have to rememberwhat steps, assumptions, tests were used.
108+
* **Easy to Modify:** You can easily extend or refine analyses by modifying existing or adding new
109+
code blocks.
110+
* **Flexible export formats:** Analysis results can be disseminated in various formats including HTML, PDF,
111+
slide shows and more.
112+
* **Easy to share:** Code and data can be shared with a colleague to replicate the workflow.
113+
114+
<i class="fa fa-star"></i> **Data Tip:**
115+
<a href="https://rpubs.com/" target= "_blank ">RPubs</a> is a one way to
116+
share and publish code online.
117+
{: .notice}
118+
119+
### RMD is beneficial to your colleagues
103120
The link between data, code and results make `.rmd` powerful. You can share your
104121
entire workflow with your colleagues and they can quickly see your process. You
105122
can also write reports using `.rmd` files which contain code and data
106123
analysis results. To enrich the document, you can add text, just like you would
107124
in a word document that describes your workflow, discusses your results and
108125
presents your conclusions - along side your analysis results.
109126

110-
## RMD is beneficial to you & your future self
127+
### RMD is beneficial to you & your future self
111128

112129
R Markdown as a format is an efficient tool. If you need to make changes to your
113130
workflow, you can simply modify the report and re-render (or knit) the report.
@@ -120,28 +137,11 @@ this one - were created using R Markdown!
120137
{: .notice}
121138

122139

123-
### Why R Markdown?
124-
There are many advantages to using R Markdown in your work:
125-
126-
* **Human readable:** it's much easier to read a web page or a report containing text and figures.
127-
* **Simple syntax:** markdown and `rmd` can be learned quickly.
128-
* **A Reminder for Your Future Self** All components of your work are clearly documented. You don't have to rememberwhat steps, assumptions, tests were used.
129-
* **Easy to Modify:** You can easily extend or refine analyses by modifying existing or adding new
130-
code blocks.
131-
* **Flexible export formats:** Analysis results can be disseminated in various formats including HTML, PDF,
132-
slide shows and more.
133-
* **Easy to share:** Code and data can be shared with a colleague to replicate the workflow.
134-
135-
<i class="fa fa-star"></i> **Data Tip:**
136-
<a href="https://rpubs.com/" target= "_blank ">RPubs</a> is a one way to
137-
share and publish code online.
138-
{: .notice}
139-
140140
## Use Knitr to convert .rmd to .pdf
141141

142142
We use the `R` `knitr` package to render our markdown and create easy to read
143143
documents from `.rmd` files. We will cover how to use `knitr` later in this
144-
series.
144+
lesson series.
145145

146146
<figure class="half">
147147
<a href="{{ site.baseurl }}/images/course-materials/earth-analytics/week-1/intro-knitr-rmd/rmd-file.png">

_posts/course-materials/earth-analytics/week-1/intro-knitr-rmd/2016-12-06-Rmd02-RMarkdown.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ your computer to complete this tutorial.
4545

4646
</div>
4747

48-
## Create a new R Markdown file in RStudio
48+
## <i class="fa fa-youtube-play" aria-hidden="true"></i> Create a new R Markdown file in RStudio
4949

5050
Watch the 6:38 minute video below to see how we convert
5151
an R Markdown file to HTML (or other formats) using `knitr` in `RStudio`.

_posts/course-materials/earth-analytics/week-1/setup-r-rstudio/2016-12-08-setup-05-working-directory.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: single
33
authors: ['Software Carpentry']
44
category: [course-materials]
5-
title: 'Install & Setup R and RStudio on Your Computer'
5+
title: 'Create a Project & Working Directory Setup'
66
excerpt: '#.'
77
nav-title: 'Setup Working Directory'
88
week: 1
@@ -11,7 +11,7 @@ sidebar:
1111
class-lesson: ['setup-r-rstudio']
1212
permalink: course-materials/earth-analytics/week-1/setup-working-directory/
1313
dateCreated: 2016-12-12
14-
modified: 2017-01-06
14+
modified: 2017-01-08
1515
author_profile: false
1616
comments: false
1717
order: 5

_posts/course-materials/earth-analytics/week-2/get-to-know-r/2016-12-06-R08-in-class-assignment.md

Lines changed: 0 additions & 136 deletions
This file was deleted.
Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
layout: single
3-
title: "Introduction to LiDAR Data"
3+
title: "Add images to a R markdown report"
44
excerpt: "."
5-
authors: ['Leah Wasser', 'NEON Data Skills']
6-
modified: 2017-01-06
5+
authors: ['Leah Wasser']
6+
modified: 2017-01-08
77
category: [course-materials]
88
class-lesson: ['hw-lidar-r']
9-
permalink: /course-materials/earth-analytics/week-3/lidar-intro/
10-
nav-title: 'Homework'
9+
permalink: /course-materials/earth-analytics/week-3/rmarkdown-images/
10+
nav-title: 'Add Images to R Markdown'
1111
module-title: 'Markdown R'
12-
module-description: 'This tutorial covers...'
13-
module-nav-title: 'Lidar Rasters in R'
12+
module-description: 'This tutorial covers how to use markdown to add an images to a report. It also discusses good file management practices associated with saving images within your project directory to avoid losing them if you have to go back and work on the report in the future.'
13+
module-nav-title: 'Refining R Markdown Reports'
1414
module-type: 'homework'
1515
week: 3
1616
sidebar:
@@ -29,52 +29,60 @@ order: 1
2929

3030
After completing this tutorial, you will be able to:
3131

32-
*
32+
* add an image to an R markdown report.
33+
* describe the ideal location to store an image associated with an r markdown report so that knitr can find it when it renders a file.
3334

3435
## <i class="fa fa-check-square-o fa-2" aria-hidden="true"></i> What you need
3536

36-
You will need a computer with internet access to complete this lesson.
37-
38-
</div>
37+
You need `R` and `RStudio` to complete this tutorial. Also you should have
38+
an `earth-analytics` directory setup on your computer with a `/data`
39+
directory with it.
3940

41+
* [How to Setup R / RStudio](/course-materials/earth-analytics/week-1/setup-r-rstudio/)
42+
* [Setup your working directory](/course-materials/earth-analytics/week-1/setup-working-directory/)
4043

44+
</div>
4145

42-
<figure>
43-
<a href="{{ site.url }}/images/course-materials/earth-analytics/week-3/lidar-trees.jpg">
44-
<img src="{{ site.url }}/images/course-materials/earth-analytics/week-3/lidar-trees.jpg" alt="Lidar data collected by NEON AOP"></a>
45-
<figcaption>LiDAR data collected at the Soaproot Saddle site by the National
46-
Ecological Observatory Network Airborne Observation Platform (NEON AOP). Source:
47-
Keith Krauss, NEON.
48-
</figcaption>
49-
</figure>
5046

5147

5248
## Add an image to your report
5349

54-
You can add images to a report using markdown. The syntax is below.
50+
You can add images to a R markdown report using markdown syntax as follows:
5551

5652
```md
5753
![alt text here](path-to-image-here)
5854
```
5955

60-
Good file management becomes extremely important when you are dealing with images.
61-
Setup an images directory in your working directory. And call each images from that
62-
directory as follows:
56+
However, when you knit the report, R will only be able to find your image if you
57+
have placed it in the right place - RELATIVE to your .Rmd file. This is where
58+
good file management becomes extremely important.
59+
60+
To make this simple, let's setup an directory named **images** in your earth-analytics
61+
project / working directory. If your .Rmd file is located in root of this directory
62+
, and all images that you want to include in your report are located in the
63+
images directory within the earth-analytics directory, then the path that you
64+
would use for each image would look like:
65+
66+
`images/week3/image-name-here.png`
67+
68+
Let's try it with an actual image.
6369

6470
```md
6571
![an image caption Source: Ultimate Funny Dog Videos Compilation 2013.](images/week3/silly-dog.png)
6672
```
6773
And here's what that code does IF the image is in the right place:
6874

69-
![an image caption Source: Ultimate Funny Dog Videos Compilation 2013.](images/week3/silly-dog.png)
70-
71-
That way when you knit, `knitr` will be able to find the images.
72-
73-
My directory is setup as follows:
75+
![an image caption Source: Ultimate Funny Dog Videos Compilation 2013.]({{ site.url }}images/course-materials/earth-analytics/week-3/silly-dog.png)
7476

77+
If all of your images are in your images directory, then `knitr` will be able to
78+
easily find them. This also follows good file management practices because
79+
all of the images that you use in your report are contained within your
80+
project directory.
7581

82+
<div class="notice--info" markdown="1">
7683

84+
## Additional Resources
7785

86+
* <a href="https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf" target="_blank">R studio R / markdown cheat sheet</a>
7887

79-
80-
Cheat sheet - https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf
88+
</div>

0 commit comments

Comments
 (0)