LilahMcC / NarwhalHR

0 stars 1 forks source link

Single data pipe #4

Open FlukeAndFeather opened 2 years ago

FlukeAndFeather commented 2 years ago

Now that you've got datetime parsing, it's a good practice to make one chunk where you read and manipulate the original data all at once. So your .Rmd will be structured something like:


---
YAML header
---

# Narwhal Heart Rate Exploration

some text

`{r setup}
# all your calls to library
`

some more text

`{r load_data}
depth_data <- reading_function(path_to_file) %>%
  mutate(parse your datetimes here) %>%
  select(rearrange and/or drop columns here)
`

Notice the syntax is all wrong, that's just to give you an outline. It's a really important practice to load and manipulate your data all at once. Otherwise what happens is your workflow will have different versions of the data frame at different steps of the process. That might be the single greatest source of bugs in analysis .Rmd files.

You're doing great. Keep it up!

https://github.com/LilahMcC/NarwhalHR/blob/f785919009890dfdd8761fc94928078cd0c3d379/Depth%20Profiles.Rmd#L62-L67