Assignment 2. R preliminaries
Due by 5:00 PM on Tuesday, September 5, 2023
Assignment 2. R preliminaries
2023-08-28
To do yourself
- Install
swirl
R package, https://swirlstats.com/students.html- Install and run the
R Programming
, course https://github.com/swirldev/R_Programming_E - Explore other swirl courses, https://github.com/swirldev/swirl_courses
- Install and run the
- Download
IntroR
code https://github.com/mdozmorov/IntroR, create a project in the code’s repository, run through theIntro_R_workshop.R
code, https://raw.githubusercontent.com/mdozmorov/IntroR/master/Intro_R_workshop.R
To submit on Canvas
- Describe different ways to install R packages. Test each method by
installing packages of your choice (e.g.,
Hmisc
,lme4
,MASS
,dslabs
). Install a GitHub package (e.g.,jokergoo/ComplexHeatmap
). How much time each method/package took? Hint: usesystem.time
function. Copy-paste selected output and describe your observations.
- Describe all ways how to find path(s) where R packages are installed. Copy-paste selected output and describe your observations. Hint: you did it in the first homework.
- What is unusual about each of the following objects?
num_char <- c(1, 2, 3, "a")
num_logical <- c(1, 2, 3, TRUE)
char_logical <- c("a", "b", "c", TRUE)
tricky <- c(1, 2, 3, "4")
- Create two numeric objects, two character objects, two logical objects. Demonstrate up to three R functions operating on each pair of objects (e.g., correlation between two numeric objects). Copy-paste selected output and describe your observations.
- Download alcohol consumption data per country from https://github.com/fivethirtyeight/data/tree/master/alcohol-consumption and demonstrate the use of basic summary functions (min, max, mean, etc.). Ask questions like which country(es) consumes most/least liters of pure alcohol, what’s the average number of beer servings, which country prefer only one type of alcohol (and what type). Describe your observation.
Alternatively, use any built-in R datasets or a dataset from TidyTuesday
- Submit your homework as a text or Word document. Files should be
named, e.g.,
LASTNAME-FIRSTNAME-HW02
.