Office Hours Megathread

  • Office Hours Megathread

     clint.thomson updated 2 weeks, 1 day ago 3Members · 21 Posts
  • David

    Organizer
    December 18, 2020 at 1:42 pm

    Hi folks, here’s a recap of our session today.

    We began by making a function to gather race/ethnicity data from the American Community Survey. We adapted the get_acs() function from the tidycensus package in a way that will automatically bring in this data whenever I need it. We discussed using the … to pass arguments from a user-generated function to one in another package. Code for this is here.

    We then talked about using variable names as arguments in functions. We created a function that can pass one or more variables to use to along with a group_by(). Code here.

    We then talked about using the flextable package and used this as an example of how to learn new packages.

    The full video is below for your viewing pleasure!

  • clint.thomson

    Member
    January 4, 2021 at 3:56 pm

    Hi David,

    Happy New Year! Hope you had a wonderful holiday. Quick question regarding iterating to Word from a Markdown template. If I leave a parameter set in my Markdown document (i.e. State = “Washington”) and then run the iteration R script to create reports for all states – will this create an issue? For example, might data unique to Washington find its way into the reports for all other states? It doesn’t seem to, but I’d welcome your response.

    Thanks!

  • David

    Organizer
    January 4, 2021 at 8:56 pm

    Great question, Clint! Yes, the parameter in the YAML doesn’t apply if you knit through an external R script. It only applies if you are knitting by hitting the knit button. Hope that answers your question!

  • clint.thomson

    Member
    January 5, 2021 at 2:39 pm

    Great! Thanks, David. The reason I asked is because it appears I need to run my Markdown file first in order to obtain a list of “states” (or programs in my case) before using them as the parameters in the render function in my iteration R script. Is this a recommended workflow? Thanks again.

  • David

    Organizer
    January 5, 2021 at 3:53 pm

    I would just separate it out so that you get the list of states/programs both in your RMarkdown file and in the separate render.R file. Just copy the code to read in the data from which you get the list of programs in two places. Does that make sense?

  • clint.thomson

    Member
    January 5, 2021 at 4:27 pm

    Yes – thank you👍

Viewing 16 - 21 of 21 posts

Log in to reply.

Original Post
0 of 0 posts June 2018
Now