My coding goals for this week

My goals for this week were to become familiar with the basics of R Markdown and to implement code, plots and everything learned in the markdown modules into a single document (this learning log).

 

Starting

I began by playing around in markdown with all the different features that Danielle showed off in her Markdown modules.

Here’s the picture of my dog that I used to test image integration, her name is Mango:

 

Plotting

Next, I tried to create a plot from the mpg data set in the data visualization module.

  1. To do this, first I installed the packages and data necessary:
library(tidyverse)
## ── Attaching packages ────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.2.1     ✓ purrr   0.3.3
## ✓ tibble  2.1.3     ✓ dplyr   0.8.4
## ✓ tidyr   1.0.2     ✓ stringr 1.4.0
## ✓ readr   1.3.1     ✓ forcats 0.4.0
## ── Conflicts ───────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
mpg
## # A tibble: 234 x 11
##    manufacturer model    displ  year   cyl trans   drv     cty   hwy fl    class
##    <chr>        <chr>    <dbl> <int> <int> <chr>   <chr> <int> <int> <chr> <chr>
##  1 audi         a4         1.8  1999     4 auto(l… f        18    29 p     comp…
##  2 audi         a4         1.8  1999     4 manual… f        21    29 p     comp…
##  3 audi         a4         2    2008     4 manual… f        20    31 p     comp…
##  4 audi         a4         2    2008     4 auto(a… f        21    30 p     comp…
##  5 audi         a4         2.8  1999     6 auto(l… f        16    26 p     comp…
##  6 audi         a4         2.8  1999     6 manual… f        18    26 p     comp…
##  7 audi         a4         3.1  2008     6 auto(a… f        18    27 p     comp…
##  8 audi         a4 quat…   1.8  1999     4 manual… 4        18    26 p     comp…
##  9 audi         a4 quat…   1.8  1999     4 auto(l… 4        16    25 p     comp…
## 10 audi         a4 quat…   2    2008     4 manual… 4        20    28 p     comp…
## # … with 224 more rows

 

  1. Next, I wanted to plot the engine displacement against the city mileage.
ggplot(data = mpg) +
   geom_point(
     mapping = aes(
       x = displ,
       y = cty
     )
   )

Challenges and successes

I think I successfully achieved my goals in gaining an insight into the very basics of RMarkdown. However, I did have a few challenges with formatting images and spacing and choosing the right file types.

What are the next steps?

I began these modules somewhat nervous. But now that I understand the basics of the software, I’m very eager to continue to learn more. In the next few days I’m going to try the more complex concepts in Danielle’s visualization and wrangling modules, and do some searching around YouTube for more tutorials.