slevin75 / ds-pipelines-targets-3

https://lab.github.com/USGS-R/many-task-pipelines-using-targets
0 stars 0 forks source link

Meet the example problem #2

Closed github-learning-lab[bot] closed 3 years ago

github-learning-lab[bot] commented 3 years ago

It's time to meet the data analysis challenge for this course! Over the next series of issues, you'll connect with the USGS National Water Information System (NWIS) web service to learn about some of the longest-running monitoring stations in USGS streamgaging history.

The repository for this course is already set up with a basic targets data pipeline that:

github-learning-lab[bot] commented 3 years ago

:keyboard: Activity: Switch to a new branch

Before you edit any code, create a local branch called "three-states" and push that branch up to the remote location "origin" (which is the github host of your repository).

git checkout main
git pull origin main
git checkout -b three-states
git push -u origin three-states

The first two lines aren't strictly necessary when you don't have any new branches, but it's a good habit to head back to main and sync with "origin" whenever you're transitioning between branches and/or PRs.


Comment on this issue once you've created and pushed the "three-states" branch.

slevin75 commented 3 years ago

ok, have done

github-learning-lab[bot] commented 3 years ago

:keyboard: Activity: Explore the starter pipeline

Without modifying any code, start by inspecting and running the existing data pipeline.

:bulb: Refresher hints:

When you're satisfied that you understand the current pipeline, include the value of oldest_active_sites$site_no and the image from site_map.png in a comment on this issue.


Add a comment to this issue to proceed.

slevin75 commented 3 years ago

ok

github-learning-lab[bot] commented 3 years ago

:keyboard: Activity: Spot the split-apply-combine

Hey, did you notice that there's a split-apply-combine action happening in this repo already?

Check out the find_oldest_sites() function:

find_oldest_sites <- function(states, parameter) {
  purrr::map_df(states, find_oldest_site, parameter)
}

This function:

and it all happened in just one line! The split-apply-combine operations we'll be exploring in this course require more code and are more useful for slow or fault-prone activities, but they follow the same general pattern.

Check out the documentation for map_df at ?purrr::map_df or online here if this function is new to you.


When you're ready, comment again on this issue.

slevin75 commented 3 years ago

ok

github-learning-lab[bot] commented 3 years ago

:keyboard: Activity: Apply a downloading function to each state

Awesome, time for your first code changes :pencil2:.

:bulb: Hint: the get_site_data() function already exists and shouldn't need modification. You can find it by browsing the repo or by hitting Ctrl-SHIFT-F. in RStudio and then searching for "get_site_data".

When you're satisfied with your code, open a PR to merge the "three-states" branch into "main". Make sure to add _targets/*, 3_visualize/out/*, and any .DS_Store files to your .gitignore file before committing anything. In the description box for your PR, include a screenshot or transcript of your console session where the targets get built.


I'll respond in your new PR. You may need to refresh the PR page to see my response.