Skip to content

Are paths with hyphens supported; if so how to use it and if not why not? #320

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

You must be logged in to vote

Yes, they are supported. But while they are fine in module library search paths1, they are discouraged in module names (including prefixes), since they are not syntactically valid R names. So the usual rules for non-syntactic R names apply: in other words, they need to be quoted in backticks.

So you can write e.g.:

box::use(../`some-path`/`to-a-file`/`some-module`[ some_object ])

But generally I recommend defining module with valid names.


1 Your example uses a relative import declaration (since it’s starting with ../), so this doesn’t apply in this case. But for non-local modules that are imported from a search path, having hyphens in the search path would require no special handling, si…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@dereckmezquita
Comment options

@gacolitti
Comment options

@klmr
Comment options

Answer selected by dereckmezquita
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants