Introducing R, Rstudio, git, and markdown

Sounds like a lot, doesn’t it?

Objective

To introduce students to the tools we will be using in class and explain why we are using them. By the end of the lesson, you should be able to

  • explain what R, Rstudio, git, and markdown are

  • open an R script, .Rmd, and .qmd file

  • define terms including function, library, and class

  • carry out basic operations in R , including

    • opening a file in R

    • producing summary statistics

    • plotting data

    • developing a linear model

    • working with markdown via .rmd or .qmd files

    • Note: The idea is just to let you see its possible! We will repeat much of this later in class for understanding

  • define and use version control

Background reading

Course notes links for background reading also contain code used to produce R output used in slides.

Lecture slides (click to open in Google slides!)

Connected assignment(click here)

Using these skills and applying concepts correctly to interpret data sets may seem easy when you read about them or listen during class, but practice is key to ensuring you understand the material. Practice problems are provided for each lesson. The link above points you to the appropriate link in the course notes. You can make a copy (technically a fork, since you can’t directly edit it) of the entire course notes website in github @ https://github.com/jsgosnell/cuny_biostats_book and work from there. The benefit is this allows you to see updates to the site (if you sync your fork). The downside is you have to work interactively or build the entire site when you render a changed file. This is doable but may take more time than students need. Alternatively, you can download just the practice problems @ https://github.com/jsgosnell/cuny_biostats_practice_problems. Your instructor may also provide alternative problems or use a different delivery method (like github classroom).

In general you should only work edit .qmd files! Everything/anything else is produced during the session and should not be edited. All files can be uploaded to github though.

Solutions are also provided for all problems via the course notes, but try them before you look at the answers!

Extra material

There are many, many R tutorials and introductions online! Below are a link to a few.