Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when running code as is from use_rmarkdown_template #761

Closed
ljanda-amplify opened this issue May 13, 2019 · 1 comment · Fixed by #815

Comments

@ljanda-amplify
Copy link

commented May 13, 2019

If you run the code as given in the default function signature for use_markdown_template(), you encounter an internal function, asciify() and therefore an error, which can be confusing to new users

usethis::use_rmarkdown_template(template_name = "Basic Template",
                        template_dir = tolower(asciify(template_name)),
                        template_description = "the most basic of templates",
                        template_create_dir = FALSE)
#> Error in asciify(template_name): could not find function "asciify"

Created on 2019-05-13 by the reprex package (v0.2.1)

@jennybc

This comment has been minimized.

Copy link
Member

commented Jul 2, 2019

The problem here is that we are revealing a non-exported helper, asciify(), which is problematic, when we reveal how the default value of template_dir is computed, which is good.

According to the tidyverse principle "Avoid magical defaults", we've decided this is a practice we'd like to avoid.

Two things need to be done:

  1. The default value of template_dir should become NULL and, internally, template_dir should be set like so:
    template_dir <- template_dir %||% tolower(asciify(template_name))
  2. The documentation of template_dir needs to be updated to reflect that it will be based on template_name, if not supplied.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.