Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
R Markdown is one of the most popular data science tools and is used to save and execute code, create exceptional reports whice are easily shareable.
The documents that R Markdown provides are fully reproducible and support a wide variety of static and dynamic output formats.
Using markdown syntax, which provides an easy way of creating documents that can be converted to many other file types, while embeding R code in the report, so it is not necessary to keep the report and R script separately. Furthermore The report is written as normal text, so knowledge of HTML is not required. Of course no additional files are needed because everything is incorporated in the HTML file.
Before proceeding, please follow our short tutorial.
Look at the examples given and try to understand the logic behind them. Then try to solve the exercises below using R and without looking at the answers. Then check the solutions.
to check your answers.
Exercise 1
Create a new R Markdown file (.Rmd) in RStudio.
Exercise 2
Insert a YAML Header with title, author and date of your choice at the top of your .Rmd script.
Exercise 3
Display the summary of “cars” dataset in your report. HINT: Use summary()
.
Exercise 4
Make a plot of the “cars” dataset under the summary you just created. HINT: Use plot()
.
Exercise 5
Create a small experimental dataframe and dipslay it in your report. HINT: Use data.frame()
.
- Build a complete workflow in R for your data science problem
- Get indepth on how to report your results in a interactive way
- And much more
Exercise 6
Hide the code from your report. HINT: Use echo
.
Exercise 7
Load the package “knitr” in your .Rmd file. and hide the code chunk. HINT: Use echo
.
Exercise 8
Hide the warning message that appeared in your report. HINT: Use warning
.
Exercise 9
Set fig.width
and fig.height
of your plot to 5.
Exercise 10
Change the file format of your plot from .png to .svg. HINT: Use dev
.
Related exercise sets:
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.