Skip to content

use()ing boxes and here::here() #260

Answered by klmr
mbojan asked this question in Q&A
Discussion options

You must be logged in to vote

I see! In this case, setting the box.path option should work:

options(box.path = c(here::here(), getOptions('box.path')))

This would need to be e.g. in a project-specific .Rprofile file. Then, box::use(codebox/whatever) should work everywhere in the project.

In general, though, the idea of ‘box’ is indeed for submodules within a project to use relative imports — that is, relative to the current module rather than relative to some encompassing project. In particular, relative imports (which start either with ./ or with ../) will always work, even in situations where here::here doesn’t.

But your use-case looks more like something where codebox is a global helper module, and in that case usi…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by klmr
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #259 on January 02, 2022 15:46.