Skip to content

Commit

Permalink
Merge pull request #103 from fhdsl/vizzz
Browse files Browse the repository at this point in the history
Redo cheatcheets in landscape form -- in case this helps with formatting
  • Loading branch information
avahoffman authored Jul 16, 2024
2 parents 791aa9e + 33b5f8d commit 59adb7f
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 7 deletions.
5 changes: 5 additions & 0 deletions modules/cheatsheets/Day-1.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
classoption:
- landscape
---

# Day 1 Cheatsheet

## Intro
Expand Down
Binary file modified modules/cheatsheets/Day-1.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions modules/cheatsheets/Day-2.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
classoption:
- landscape
---

# Day 2 Cheatsheet

## Basic R
Expand Down
Binary file modified modules/cheatsheets/Day-2.pdf
Binary file not shown.
9 changes: 7 additions & 2 deletions modules/cheatsheets/Day-3.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
classoption:
- landscape
---

# Day 3 Cheatsheet

## Subsetting Data in R
Expand All @@ -11,8 +16,8 @@
| `dplyr`| [`slice_sample(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/dim)|`slice_sample(mtcars)`| See a random subset of the rows of `x`|
| Base `R`| [`data.frame()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/data.frame)| `df <- data.frame(1:3)`| Creates a data frame where the named arguments will be the same length.|
| Base `R`| [`tibble()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/data.frame)| `tibble(mtcars)`| Creates a tibble from a data.frame or matrix. |
| `tibble`| [`column_to_rownames()`](https://www.rdocumentation.org/packages/tibble/versions/1.4.2/topics/rownames) | `df <- df %>% column_to_rownames('existing_variable_name')`| Transforms an existing column called by a string into the rownames.|
| `tibble`| [`rownames_to_column()`](https://www.rdocumentation.org/packages/tibble/versions/1.4.2/topics/rownames)|`df <- df %>% column_to_rownames('new_variable_name')`| Transforms the rownames of a data frame into a column (which is added to the start of the data frame). The string supplied as an argument will be the name of the new column.|
| `tibble`| [`column_to_rownames()`](https://www.rdocumentation.org/packages/tibble/versions/1.4.2/topics/rownames) | `df <- df %>% column_to_rownames('old_col')`| Transforms an existing column called by a string into the rownames.|
| `tibble`| [`rownames_to_column()`](https://www.rdocumentation.org/packages/tibble/versions/1.4.2/topics/rownames)|`df <- df %>% column_to_rownames('new_col')`| Transforms the rownames of a data frame into a column (which is added to the start of the data frame). The string supplied as an argument will be the name of the new column.|
| `dplyr`| [`rename()`](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/topics/select)|`df <- rename(df, MPG = mpg)`| Renames designated columns while keeping all variables of the data.frame |
| `dplyr`| [`pull()`](https://dplyr.tidyverse.org/reference/pull.html)|`pull(df, 'existing_variable_name')`| Extract a column as a vector |
| `dplyr`| [`select()`](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/topics/select)|`select(df, 'existing_variable_name')`| Selects columns that match the specified argument|
Expand Down
Binary file modified modules/cheatsheets/Day-3.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions modules/cheatsheets/Day-4.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
classoption:
- landscape
---

# Day 4 Cheatsheet

## Data Summarization
Expand Down
Binary file modified modules/cheatsheets/Day-4.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions modules/cheatsheets/Day-5.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
classoption:
- landscape
---

# Day 5 Cheatsheet

## Data Cleaning
Expand Down
Binary file modified modules/cheatsheets/Day-5.pdf
Binary file not shown.
8 changes: 4 additions & 4 deletions modules/cheatsheets/Day-6.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
output:
pdf_document: default
html_document: default
classoption:
- landscape
---

# Day 6 Cheatsheet

## Data Manipulation
Expand All @@ -17,7 +17,7 @@ output:
|---------------|-------------|----------------|-------------|
| `dplyr`| [`separate()`](https://tidyr.tidyverse.org/reference/separate.html)| `df %>% separate(x, c("A", "B"))`| Separate a character column into multiple columns with a regular expression or numeric locations|
| `dplyr`| [`unite()`](https://tidyr.tidyverse.org/reference/unite.html)| `df %>% unite("z", x:y, remove = FALSE)`| Unite multiple columns together into one column|
| `tidyr`| [`pivot_longer()`](https://tidyr.tidyverse.org/reference/pivot_longer.html)| `df %>% pivot_longer(!column_to_not_touch, names_to = "new_col_with_labels", values_to = "new_col_with_values")`| Lengthens a data frame by increasing the number of rows and decreasing the number of columns.|
| `tidyr`| [`pivot_longer()`](https://tidyr.tidyverse.org/reference/pivot_longer.html)| `df %>% pivot_longer(!col_to_keep, names_to = "new_col_with_labels", values_to = "new_col_with_values")`| Lengthens a data frame by increasing the number of rows and decreasing the number of columns.|
| `tidyr`| [`pivot_wider()`](https://tidyr.tidyverse.org/reference/pivot_wider.html)| `df %>% pivot_wider(names_from = "col_with_names", values_from = "col_with_values")`| Widens a data frame by decreasing the number of rows and increasing the number of columns.|
| `dplyr`| [`?_join()`](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/topics/join) | `inner_join(x, y)`| Joins data from two data frames. <br> **inner_join** - only rows that match for x and y are kept. <br> **full_join** - all rows of x and y are kept. <br> **left_join** - all rows of x are kept even if not merged with y. <br> **right_join** - all rows of y are kept even if not merged with x. <br> **anti_join** - all rows from x not in y keeping just columns from x. |
|Base `R`| [`duplicated()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/duplicated)| `duplicated(x)`| Determines and removes duplicate elements from `x`.|
Expand Down
Binary file modified modules/cheatsheets/Day-6.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions modules/cheatsheets/Day-7.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
classoption:
- landscape
---

# Day 7 Cheatsheet

## Data Visualization
Expand Down
Binary file modified modules/cheatsheets/Day-7.pdf
Binary file not shown.
7 changes: 6 additions & 1 deletion modules/cheatsheets/Day-8.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
classoption:
- landscape
---

# Day 8 Cheatsheet

## Statistics
Expand All @@ -15,7 +20,7 @@
| Base `R`| [`var.test(x, y)`](http://www.sthda.com/english/wiki/f-test-compare-two-variances-in-r)|`var.test(x, y)`| Compare two variances with Fisher's F-test |
| Base `R`| [`chisq.test(x, y)`](http://www.sthda.com/english/wiki/f-test-compare-two-variances-in-r)|`chisq.test(x, y)`| Perform chi squared contingency tables and goodness of fit tests |
| Base `R`| [`lm(x ~ y)`](https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/lm)|`lm(x ~ y, data = df)`| Fit linear models based on a formula you provide. |
| Base `R` [`summary(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/summary)| summary(linear_model_result) | Returns a summary of the values in object, including a linear model or other statistical test. |
| Base `R`| [`summary(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/summary)| summary(linear_model_result) | Returns a summary of the values in object, including a linear model or other statistical test. |
| Base `R`| [`glm(x ~ y)`](https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/glm)|`glm(x ~ y, data = df, family = binomial())`| Fit generalized linear models based on a formula you provide. Must specify the error distribution and link function using the `family` argument. |


Expand Down
Binary file modified modules/cheatsheets/Day-8.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions modules/cheatsheets/Day-9.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
classoption:
- landscape
---

# Day 9 Cheatsheet

## Functions
Expand Down
Binary file modified modules/cheatsheets/Day-9.pdf
Binary file not shown.

0 comments on commit 59adb7f

Please sign in to comment.