Skip to content

assert_here() #27

Description

@jennybc

It would be interesting to consider an assert_here() function.

Inspired by this Twitter conversation with Emile Latour (@emilelatour).

Problem: you use Projects and the here package and life is awesome. But your collaborator still clicks on an Rmd in the Finder and it just opens in RStudio, in whatever Project (or non-Project) they happen to have open. Now all the path-building code doesn't work as planned when they run chunks interactively (knitting the whole document still works fine for them).

If you want to make a .R or .Rmd file more resilient to this and you feel like the Project's name is pretty stable, you could put here::assert_here("PROJECT_NAME") at the top as a way of raising an alarm when the workflow violates expectations.

assert_here() would be something like assertthat::assert_that(identical(basename(here::here()), “PROJECT_NAME”)).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions