Watts-College / cpp-527-fall-2021

A course shell for CPP 527 Foundations of Data Science II
https://watts-college.github.io/cpp-527-fall-2021/
2 stars 6 forks source link

navigating long RMD files #5

Open AmyTrumpower opened 3 years ago

AmyTrumpower commented 3 years ago

Hi Dr. Lecy: I was wondering if I could break up Lab 2 into 2 RMD files; one for Part 1 and one for Part 2. The file is getting unwieldly in R-Studio. I was not sure if practicing navigating a lengthy program was part of the "R Adventure" or if there would be any impact to future assignments.

Thank you in advance, Amy

lecy commented 3 years ago

Unwieldy in length of the document or time it takes to run?

The table of contents (TOC) features in RMD docs comes in handy for navigating longer files. Be sure to use headers to create proper anchors.

# part 1
## question 1
etc
---
output:
  html_document:
    theme: readable
    highlight: tango
    toc: true
    toc_float: true
---

Figuring out how to keep all of the parts organized in your head (packages, data, functions, documents) and in your RMD file is a huge part of the learning curve!

lecy commented 3 years ago

Next semester you will actually practice some file management systems.

Normally your functions would be stored in an external utils.R file and "sourced" (loaded) from there.

These labs do get quite cluttered. It's OK, though, as long as the knit-time is not unwieldy.

AmyTrumpower commented 3 years ago

It was just a length issue, but using the TOC will help. I was doing a lot of scrolling. Thanks for the idea that should cover it.

lecy commented 3 years ago

There are some advanced features in R Studio to help with navigation. If you haven't discovered it yet there is an internal TOC that will navigate to sections of your doc:

image

I rarely use code chunk names but you can add them for chunks that you need to find quickly and it will display them in that TOC list.

```{r caseA}

Visual Studio has a nice miniature code preview on the right hand side that is great for navigation. I will use this sort of editor when I'm working directly with scripts and don't need to produce RMD docs:

image