Skip to content

Commit

Permalink
Added a few intro slides
Browse files Browse the repository at this point in the history
  • Loading branch information
robjhyndman committed Feb 27, 2024
1 parent 56acb7b commit dd919ee
Showing 1 changed file with 32 additions and 11 deletions.
43 changes: 32 additions & 11 deletions week1/slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ source(here::here("course_info.R"))
\vspace*{0.4cm}
\tableofcontents

## First things first

### Expectations

* You know R and RStudio
* You have a basic understanding of programming (for loops, if statements, functions)
* You can use Git and GitHub (https://happygitwithr.com)

### Unit resources

* Everything on **https://arp.numbat.space**
* Assignments submitted on Github Classroom
* Discussion on Ed

## GitHub

* Use your monash edu address.
* Apply to GitHub Global Campus as a student (https://education.github.com).
* Gives you free access to private repos and GitHub Copilot.
* Add GitHub Copilot to RStudio settings.

# Introduction to R
## R history

Expand Down Expand Up @@ -63,7 +84,7 @@ source(here::here("course_info.R"))

# Names and values

## Quiz
## Exercises
\fontsize{12.5}{13}\sf

1. Given the following data frame, how do I create a new column called "3"
Expand Down Expand Up @@ -317,7 +338,7 @@ knitr::include_graphics("../diagrams/name-value/character.png")
knitr::include_graphics("../diagrams/name-value/character-2.png")
```

## Quiz
## Exercises

4. Sketch out the relationship between the following objects:

Expand Down Expand Up @@ -367,7 +388,7 @@ obj_size(c(1:1e6, 10))
obj_size(2 * (1:1e6))
```

## Quiz
## Exercises

6. Predict the output of the following code:

Expand Down Expand Up @@ -602,7 +623,7 @@ sum(x)
as.integer(c("1", "1.5", "a"))
```

## Quiz
## Exercises

7. Predict the output of the following:

Expand Down Expand Up @@ -726,7 +747,7 @@ str(matrix(1:3, nrow = 1)) # row vector
str(array(1:3, 3)) # "array" vector
```

## Quiz
## Exercises

10. What does `dim()` return when applied to a 1-dimensional vector?
11. When might you use `NROW()` or `NCOL()`?
Expand Down Expand Up @@ -841,7 +862,7 @@ structure(now_ct, tzone = "Australia/Lord_Howe")
```


## Quiz
## Exercises

13. What sort of object does `table()` return? What is its type? What
attributes does it have? How does the dimensionality change as you
Expand Down Expand Up @@ -1070,7 +1091,7 @@ str(dfm)

\placefig{10}{1.25}{width=5cm,height=20cm}{../diagrams/vectors/data-frame-matrix.png}

## Quiz
## Exercises

16. Can you have a data frame with zero rows? What about zero columns?
17. What happens if you attempt to set rownames that are not unique?
Expand All @@ -1095,7 +1116,7 @@ is.null(x)

# Subsetting

## Quiz
## Exercises

20. What is the result of subsetting a vector with positive integers,
negative integers, a logical vector, or a character vector?
Expand All @@ -1104,7 +1125,7 @@ is.null(x)
23. If `x` is a matrix, what does `x[] <- 0` do? How is it different from `x <- 0`?
24. How can you use a named vector to relabel categorical variables?

## Quiz
## Exercises
\fontsize{13}{14}\sf

25. Fix each of the following common data frame subsetting errors:
Expand All @@ -1122,7 +1143,7 @@ is.null(x)
27. Implement your own function that extracts the diagonal entries from a
matrix (it should behave like `diag(x)` where `x` is a matrix).
## Quiz
## Exercises
28. Extract the residual degrees of freedom from `mod`
Expand All @@ -1133,7 +1154,7 @@ is.null(x)
29. Extract the R squared from the model summary (`summary(mod)`)
## Quiz
## Exercises
30. How would you randomly permute the columns of a data frame?
31. Can you simultaneously permute the rows and columns in one step?
Expand Down

0 comments on commit dd919ee

Please sign in to comment.