R for Researchers: R Markdown solutions
April 2015
This article contains solutions to exercises for an article in the series R for Researchers. For a list of topics covered by this series, see the Introduction. If you're new to R we highly recommend reading the articles in order.
There is often more than one approach to the exercises. Do not be concerned if your approach is different than the solution provided.
Exercise solutions
Open a new R Markdown file with an output format of HTML. Give the document the title "My RFR class notes".
There is no code associated with the solution to this problem.
The meta data section of the .Rmd file you opened should be as follows
--- title: "My RFR class notes" output: html_document ---
Save the file created in exercise 1 as "Notes" in the RFR project folder.
There is no code associated with the solution to this problem.
Remove all of the document text and commands after the metadata section.
There is no code associated with the solution to this problem.
Add a level 2 header with the title of this article.
## R Markdown
Following the header created in the exercise above, write a note to remind yourself of at least one thing about formatting using Markdown.
An enumerated list can start with any integer value. All additional items in the list are numbered sequentially from this starting integer value.
In the text you wrote for the exercise above, use a text modifier (bold, italic, etc.) to highlight a key work or phrase from the text.
An **enumerated list** can start with ***any integer*** value. All additional items in the list are numbered ***sequentially*** from this starting integer value.
Ignore the Notes.html file and commit the Notes.Rmd and .gitignore files with the commit message "Added notes for R Markdown article".
There is no code associated with the solution to this problem.
Demonstrate the use of in line R code to calculate the results of ((43 - 17)*.1)^2.
The following are a few examples of the use of R code In line calculation `r ((43 - 17)*.1)^2`
Demonstrate the use of a chunk to calculate the expression from the prior problem.
A code block ```{r} ((43 - 17)*.1)^2 ```
Same problem as prior problem with the addition of using chunk option(s) to prevent the R source code from being displayed.
A code block which does not echo the source text ```{r echo=FALSE} ((43 - 17)*.1)^2 ```
Commit the Notes.Rmd file with the commit message "Added R code examples to Notes".
There is no code associated with the solution to this problem.
One possible completed Notes.Rmd file
--- title: "My RFR class notes" output: html_document --- ## R for Researchers: R Markdown An **enumerated list** can start with ***any integer*** value. All additional items in the list are numbered ***sequentially*** from this starting integer value. The following are a few examples of the use of R code In line calculation `r ((43 - 17)*.1)^2` A code block ```{r} ((43 - 17)*.1)^2 ``` A code block which does not echo the source text ```{r echo=FALSE} ((43 - 17)*.1)^2 ```
Return to the R Markdown article
Last Revised: 2/2/2015