Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solving bigger problems cleanup #993

Merged
merged 4 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/Repro-megafaunal-extinction.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ three main figures from one of the major papers on this topic [Lyons et al.
2004](http://www.evolutionary-ecology.com/issues/v06n03/ddar1499.pdf).

You will do this using a
[large dataset of mammalian body sizes](https://datacarpentry.org/semester/data/mammal-size-data-clean.tsv)
[large dataset of mammalian body sizes](https://datacarpentry.org/semester/materials/data/mammal-size-data-clean.tsv)
that has data on the mass of recently extinct mammals as well as extant mammals
(i.e., those that are still alive today).

Expand Down
18 changes: 18 additions & 0 deletions lessons/R-solving-bigger-problems.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
layout: page
element: lesson
title: Solving Bigger Problems
language: R
---

1\. Watch the Paths and RStudio Projects video:

<iframe title="Paths and RStudio Projects video" width="560" height="315" src="https://www.youtube.com/embed/2sReMmTMYFk" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

2\. Watch the Settings And Approaches To Improve Reproducibility When Coding In RStudio video:

<iframe title="Settings And Approaches To Improve Reproducibility When Coding In RStudio video" width="560" height="315" src="https://www.youtube.com/embed/4HrWj8oNkIY" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

3\. Watch the Exporting Work From Posit Cloud video:

<iframe title="Exporting Work From Posit Cloud video" width="560" height="315" src="https://www.youtube.com/embed/DL9wjlfnwVM" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
91 changes: 16 additions & 75 deletions materials/googling-for-help.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,22 @@
---
layout: page
element: notes
title: Googling for Help
title: Searching for Help
language: R
---

> Check that top Google results haven't change and adjust as needed
> Current top hits 1, 2, and 5:
> 1. https://dplyr.tidyverse.org/reference/select.html
> 2. https://blog.exploratory.io/selecting-columns-809bdd1ef615
> 3. https://stackoverflow.com/questions/21502465/replacement-for-rename-in-dplyr

* Professional programmers use Google regularly
* Learning how to search, read, and apply online help is a key skill
* Requires
* Vocabulary
* Look for cheatsheets
* Careful reading
* Understanding
* Testing


### Example

* How to change the name of columns in dplyr
* Search: `dplyr change name column`
* Name of package (if not in a distinctly name package include `r` or
`rstats`)
* The thing you want to do using technical terms
* Keep it simple
* Sometimes first searches show you how to ask the question
* Switch to `dplyr rename column`
* Check the date
* Older results might be out of date
* Can restrict to newer posts in search (but often more advanced)

#### First hit

> https://dplyr.tidyverse.org/reference/select.html

* Documentation
* Start reading from top
* Not super clear
* Focus on examples
* `Ctrl-F`
* `petal_length` is in output, so it is the new name and `Petal.Length` is the old value

#### Second hit

> https://blog.exploratory.io/selecting-columns-809bdd1ef615
> * Ask students for something they want to search
> * Demo searching for an answer
> * Highlighting points below

* Blog post
* Kind of long
* `Ctrl-F`
* `rename()` function, but what's the order
* Look at the setup: `github_issues`
* Scroll up and look at column names
* `assignee.login` is in the orginal setup, so that is the variable we are changing, `developer` is new name

#### Fifth hit

> https://stackoverflow.com/questions/21502465/replacement-for-rename-in-dplyr

* Question & Answer site
* Want `rename` so this seems good.
* Read question
* Check date - possible out of date
* Very clear statement of solution
* Check comments - it's so clear because someone helped
* Look at next answer - we could do this with select as well

#### Testing and modifying answers

* Test the example
* Modify the example
* But be careful
* Malicious code examples exist
* Do you trust the site
* Does it have a lot of upvotes
* Top of searches with lots of hits


### Tips (not taught, but should be highlighted in example)
### Tips

#### Search

* Get the vocabularly right
* Get the vocabulary right
* Avoid extra words
* Specify the language

Expand All @@ -112,3 +43,13 @@ language: R

* Use `Find`
* Focus on the examples

#### Testing and modifying answers

* Test the example
* Modify the example
* But be careful
* Malicious code examples exist
* Do you trust the site
* Does it have a lot of upvotes
* Top of searches with lots of hits
46 changes: 23 additions & 23 deletions materials/problem-decomposition.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ time: 30 minutes

## Problem decomposition steps (10 minutes)

1. Understand the problem
1. Restate the problem in your own words.
2. Know what the desired inputs and outputs are.
3. Ask questions for clarification (in class these questions might be to
your instructor, but most of the time they will be asking either yourself
or your collaborators).
2. Break the problem down
1. Into a few large pieces.
2. Write down, either on paper or as comments in a file.
3. Break complicated pieces down into smaller pieces.
4. Keep doing this until all of the pieces are small.
3. Code one small piece at a time.
1. Think about how to implement it.
2. Write the code.
3. Test it on it's own and fix any problems.

## Exercises (15 minutes)
> Put this up on screen

1. 🤔️
2. 🕺️
3. 🧱️


1. 🤔️ Understand the problem
1. Restate the problem in your own words
2. Determine the inputs and outputs
3. Ask for clarification
2. 🕺️ Break the problem down
1. Write down the pieces, on paper or as comments in a file
2. Break complicated pieces down until all pieces are small and manageable
3. 🧱️ Code one small piece at a time
1. Test it on it's own
2. Fix any problems before proceeding

## Breaking down an exercise (15 minutes)

* This week we will be working on more complex exercises
* Show end result of first exercise
* Take time now in class to understand and break down the problem
* Spend 15 minutes working these first two steps
* Only start coding if you've fully understood and broken down the problem
* Take time 5 minutes to read through one of the exercises
* Then we'll try to break it down into pieces as a class

## Start simple

## Make a simpler version first (5 minutes)

If you aren't sure how to do something, make a simpler version that you do know
how to do first.

1. Experiment
2. Write a simpler version
Expand Down