Skip to content

Commit

Permalink
adding cheatsheets and gut checks
Browse files Browse the repository at this point in the history
  • Loading branch information
carriewright11 committed Dec 26, 2024
1 parent b49effd commit be75ba6
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion modules/Data_Cleaning/Data_Cleaning.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,13 @@ data_ginger_mint %>%
count(Group, Effect)
```

## GUT CHECK: If we want all unspecified values to remain the same with `case_when()`, how should we complete the `TRUE ~` statement?

A. With the name of the variable we are modifying or using as source

B. With the word "same"


# Working with strings

## Strings in R
Expand Down Expand Up @@ -734,14 +741,23 @@ data_ginger_mint %>%
count(Treatment, Treatment_recoded)
```

This is a more robust solution! It will catch typos as long as first letter is correct or there is part of the word mint.
This is a more robust solution! It will catch typos as long as the first letter is correct or there is part of the word mint.

## That's better!

```{r, echo = FALSE, fig.align='center', out.width= "30%"}
knitr::include_graphics("https://media1.giphy.com/media/S9ZK4mmi3u3jdc5dek/200w.webp?cid=ecf05e47h7myga959jwvek6s9x1tkog135g7pxu8vvjz2yqb&rid=200w.webp&ct=g")
```


## GUT CHECK: What `stringr` function helps us find a string pattern?

A. `str_replace()`

B. `str_find()`

C. `str_detect()`

# Separating and uniting data

## Uniting columns
Expand Down Expand Up @@ -806,6 +822,8 @@ knitr::include_graphics("images/case_when.png")

📃 [Day 5 Cheatsheet](https://jhudatascience.org/intro_to_r/modules/cheatsheets/Day-5.pdf)

📃 [Posit's `stringr` Cheatsheet](https://evoldyn.gitlab.io/evomics-2018/ref-sheets/R_strings.pdf)

```{r, fig.alt="The End", out.width = "50%", echo = FALSE, fig.align='center'}
knitr::include_graphics(here::here("images/the-end-g23b994289_1280.jpg"))
```
Expand Down

0 comments on commit be75ba6

Please sign in to comment.