Coding Notebook

What is This?

This is a public-facing notebook about what I’m doing, what I’m struggling to do, and what mistakes I’ve been making.

Week 1

This week (May 29 to June 4), I set up a preliminary animint2 reference website.

Learned

  • Learned more about the pkgdown R package:
  • Learned more about git:
  • Looked up some tips on how to write code comments better. Tips from: Antonin Januska and Ellen Spertus.
  • Learned that the string GITHUB_PAT can be found in the .github/workflows directory.
  • Learned about documentation managers. There’s: Zeal and DevDocs.
  • Learned that there are, like, eight test suites. And they automatically run when you make a pull request to the animint2 repository. That’s nice. I’m also learning that the tests take a long time to run—about 45 minutes.
  • Turns out that ripgrep-all doesn’t look through YAML files. I need something like yq instead. Why?

Created

  • Created README.md from the README.org file via the magic of pandoc.
  • Created a preliminary website and documented how I generated it:
    • For the documentation and code, see website_setup.Rmd. Currently have information about building the website.
    • Put the site up online.
  • Accidentally made a pull request in tdhock/animint2. Should’ve been ampurr/animint2 instead. I closed it—be more careful.
  • Made a pull request in ampurr/animint2 but did not initially succeed in closing it due to a test failing. Later, I pushed it anyway, which then threw the website online.
  • Successfully set up the website. But there are some errors. Most noticeably: it includes some functions that don’t seem to be part of animint2. Will need to investigate further.

Confused

One of the tests—“Test Suite compiler”—failed. Here’s the error message:

Code
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-compiler-gist.R:4:3'): animint2gist() returns an object of class 'gist' ──
Error: Error: In non-interactive environments, please set GITHUB_PAT env to a GitHub access token (https://help.github.com/articles/creating-an-access-token-for-command-line-use)
Backtrace:

 1. └─animint2::animint2gist(list(p = qplot(1:10)), browse = FALSE) at test-compiler-gist.R:4:2
 2.   └─gistr::gist_create(...)
 3.     ├─gistr:::gist_POST(...)
 4.     │ └─gistr:::cVERB(...)
 5.     │   └─crul::HttpClient$new(url, headers = c(auth, headers), opts = list(...))
 6.     │     └─crul (local) initialize(...)
 7.     └─gistr::gist_auth()

[ FAIL 1 | WARN 0 | SKIP 5 | PASS 756 ]
Error: Error: Test failures
Execution halted
Error: Process completed with exit code 1.

This is confusing, since I thought GITHUB_PAT was already set with a GitHub Access Token. I was also unaware of the large array of tests that activate when you try to push something. Quite frankly, I’m not sure what they do or what they prevent. It feels different than using testthat.

I also don’t understand the GitHub workflow stuff. What exactly is GitHub doing?

Week 2

This week (June 5 to June 11), I tried to fix issue 89. I did not succeed.

Learned

  • Learned that the roxygen2 package generates both the .Rd files and part of the DESCRIPTION for packages.
  • Learned that devtools AUR package has so so so many dependencies.
  • This is real basic, but I re-learned that bash foo.sh runs shell scripts. I haven’t run one since September of 2022.
  • Looked into Writing R Extensions, which I was not previously aware existed:
  • When using Git Bash—i.e. MinGW—and cd, I need to swap the backwards slashes for forward slashes. Oddly, the backwards slashes work for some directories but not for others. It took me a while to realize this while debugging.
  • Figured out that the borders() function is part of fortify-map.r. That’s why it disappeared when I deleted that R file.
  • Learning about bash.
  • Learned that all the tidyverse data tidiers will eventually be retired. This includes both ggplot2::fortify() and broom::tidy().

Created

Nothing of value. I created several branches to try and fix the issue and didn’t succeed.

  • One branch focused on removing the fortify functions in animint2. This caused several tests to fail. Later, Toby told me that map_data is used in several tests and relies on the fortify functions.
  • As part of a debugging process, one branch was a copy of the main branch with an additional text document. It was meant to test the GitHub tests. It passed the tests.
  • Another branch was meant to debug the branch where I removed the fortify functions.

Failed

My debugging process didn’t succeed. Or, at the very least, it didn’t succeed in time.

Parts of it were headed in the right direction. After some experimentation, I confirmed that the problem stemmed from my changes to the repository (the removal of the fortify functions) and not from either build.sh or the GitHub tests. But my debugging was focused on the following error message:

Error in FUN(X[[i]], ...): numeric ‘envir’ arg not of length one.

This error message comes from the ggplot2 side of animint2’s code. In some sense, I was looking in the right direction—the fortify functions are from the ggplot2 side of things. But I was focused on figuring out substitutes for fortify and failed to notice that the problem was with map_data.

Confused

For some reason, build.sh always fails to generate the \(\LaTeX\) document correctly, mentioning some problem with the .Rd files. Then I think it runs the process again, and the problem disappears. Why?

Why are the tidyverse data tidiers being retired? I can’t find any info about that.

yay -S r-plyr r-reshape2 isn’t working and requires “manual intervention.” Why? Luckily, this isn’t important—build.sh runs perfectly fine on Git Bash and therefore I don’t actually need to figure out why the yay helper is acting this way.

Week 3

This week (June 12 to June 18), I complained a lot. I chatted with Fei, who said that she would take care of issue 90. Thank you, Fei!

Learned

Created

  • Made a comment in issue 90. Fei fixed Big Bug, but Little Bug is left.
  • Made a new issue: issue 96, which is about some \(\LaTeX\) errors that seem exclusive to me.

Week 4

This week (June 19 to June 25), I tried to set up the reference website again—this time in Toby’s repository instead of my fork. This didn’t work, so I started tinkering with my fork again.

Learned

Created

A mess. I accidentally merged my changes from my fork of animint2 into the original animint2 repository. Whoops.

Week 5

This week (June 26 to July 2), I’m setting the website up again. Yay! Toby said that he wants me to replace the README entirely, so that’s happening, too.

Learned

Created

  • Toby created an organization, animint, for the animint2 repository. I did some things with it:
    • I changed the profile picture to a dittered Suki. Improving the world one cat pic at a time.
    • I changed the settings so that we can control things with our personal access tokens (PATs). If you want, go to Settings > Third-party Access > Personal Access Tokens to change it back.
    • I generated a PAT for animint2.
  • Converted README.md to README.qmd, which will let me do R computations for the website homepage.
  • Added the “Differences with other packages” section from README.org to the animint2 repo wiki.

In Progress

  • I’m thoroughly updating and cleaning up the website_setup.Rmd document.
  • I’m editing README.qmd to be clearer and more immediately useful. Later, I’ll convert it to README.md for pkgdown to read.

Week 6

Hoping to finish up the website this week (July 3 to July 9).1 Weird bugs exclusive to me and GitHub-specific problems… I’m behind on my timeline for reasons I didn’t anticipate. Good learning experience, though I’m learning about things I didn’t anticipated.

  • 1 Editor’s note: this didn’t happen.

  • Learned

    Created

    • Created vignettes/simple-examples.Rmd to house the usage examples for the README document. Why? Cuz GitHub doesn’t allow JavaScript in its READMEs.

    Other Notes

    • When using animint::labs(), subtitles, tags, and captions don’t work. ggplot2 page for the function is here.

    Week 7

    This week (July 10 to July 16), I’ve continued work on the quick start guide.

    Learned

    Created

    • Massaged simulated data until they were useful and looked somewhat real.
    • Continued work with simple-examples.Rmd, which was renamed quick-start.Rmd. The simple examples vignette has transformed into a larger quick start guide.

    Week 8

    This week (July 17 to July 23), I finally finished the quick start guide. And the README, too. I also worked a little on website_setup.Rmd and _pkgdown.yml.

    Learned

    • Erik Bernhardsson has an analysis for why software projects take longer than expected. For obvious reasons, it’s something I’ve been thinking about regarding the reference website project.
    • Learned (or re-learned) about the signif() function, which is useful for rounding and cutting off overly-precise numbers.
    • Data Visualization: A Practical Introduction has a section on broom in Chapter 6. Useful, since it’s unclear to me what data tidiers do.
    • There are ways to place plots side by side in ggplot2, but those methods don’t work in animint2. ggplot2: Elegant Graphics for Data Analysis link. Stack Overflow link.
    • You can remove legends and axes in ggplot2. These solutions throw up errors when used with animint2.
    • In Notepad++:
      • Edit > Blank Operations offers you the option to delete trailing whitespaces.
      • AltShift throws you into column mode. Good for mass editing.
    • Comments are the same in both R and YAML. Use the # sign.

    Created

    • Finished drafts for quick-start.Rmd, README.qmd, and README.md. Yay!

    In Progress

    • Worked on _pkgdown.yml.

    Other Notes

    • animint() fails to render ggplots that uses geom_smooth().

    Week 9

    This week (July 24 to July 30), I continued working on pkgdown.yml.

    Learned

    Created

  • 2 Editor’s note: this was the result of three misnamed topics. They’ve since been changed.

  • Week 10

    This week (July 31 to August 6), I finished _pkgdown.yml.

    Learned

    • incomplete final line warning message is the result of
    • Topics filed under title: internal may show up anyway. This is the result of strangely specific syntax requirements.
    • Using an SVG workaround, it’s possible to use CSS in a GitHub README.
    • In Notepad++, you can use the CTRLJ shortcut to join lines and remove line breaks.
    • There’s an odd warning message when you build or check the site with pkgdown: incomplete final line found on './_pkgdown.yml'. There’s a bug report about it. It’s a YAML thing, but I’m not sure why.
      • Just gonna ignore it for now.

    Created

    • Finished pkgdown.yml! Woot woot!
      • Reorganized all the topics.
      • Wrote up descriptions for the titles.

    Week 11

    This week (August 7 to August 13), I put a mostly-finished website online! Woot woot!

    Learned

    Created

    • Did lots of website stuff:
      • Removed docs from the .gitignore website.
      • Finally threw the official animint2 site online. Here it is.
      • Made minor changes to the alt text.
      • Fixed an alt text–figure caption duplication error by using <img src="source" alt="alt text"> instead of ![alt text](source).
      • Moved world_bank_screencast.gif to man/figures. It’s a pkgdown convention.
      • Created pkgdown/extra.css and wrote some CSS to make changes to the website. It’s a pkgdown convention.
    • Made a PR to begin closing issue 100.
      • It’s about how some of the datasets lack either a source (2) or a codebook (19). Or both (19).
      • Added a bunch of TODOs in the .Rd files in man/.
      • Added a todo.md file briefly explaining the TODO nomenclature.

    Other Notes

    • There seems to be a minor accessibility bug with pkgdown. When you use ![alt text](source) and render it as an HTML file, it takes the alt text and renders it twice: as the alt text and also as the figure caption.

    Week 12

    This week (August 14 to August 20), I worked on improving the website, mostly with CSS.

    Learned

    Created

    • Fei reported a bug under issue 102. I tested it.
    • Finally got the animints working in the quick start guide! I’ve moved the guide to its own section on the navigation bar.
    • Some other website changes:
      • Switched the font from system-ui to Roboto Condensed and Roboto Mono.
      • Changed the link color to match the link color on Toby’s website.
      • Increased spacing between each heading.
      • Generated code annotations from code comments cuz I don’t have direct access to the HTML. This was hard!

    Confused

    Okay. Debugging notes. The problem is that the website won’t render our animints. This seems to be the result of two issues:

    • pkgdown renders the animints in the vignettes/ directory instead of docs/articles/.
    • Having the animints in docs/articles/ doesn’t appear to do anything.

    My guess is that it’s a pkgdown thing. Quarto renders it, so the origin of the problem’s not animint2. The animint2 Manual renders it, too. So it’s not anything to do with R Markdown.

    The JavaScript output looks the same as well. It’s a bunch of <script type="text/javascript" src="animint/directories"> for the first codeblock, followed by <script>var chunk_name = new animint("#chunk_name", "chunk_name/plot.json");</script> for any future codeblocks. So there’s nothing wrong with the code being generated.

    Maybe the code needs to be generated in the docs/ directory instead of vignettes/? But why? I used fc.exe to look at the files and obviously there’s no difference between them.

    Oddly, the bug fixed itself. I just renamed the file and now the animints work. Bizarre.

    Week 13

    Work product submission week (August 21 to August 28)! 🐈

    Learned

    Created

    • Finished website maintenance document and renamed the file readme_website.md.
    • Converted NEWS to NEWS.md and edited it so that pkgdown could read it and render it as the changelog.
    • Toby suggested major changes to the quick start guide, which I implemented. He suggested other major changes that I still need to implement.

    Additional Work

    This section tracks work I’ve done immediately after GSOC ended—August 29th and beyond.

    Learned

    Created

    • Worked on an <aside> to let Firefox users know about the scrolling bug.
    • Tried to work on issue 90. I thought I had a solid lead re: the zoom property, but that hasn’t worked out so far.
    • Swapped in README.md for README.org for .Rbuildignore.