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
|
Simple question I have paths with hyphens in them like so: box::use(../some-path/to-a-file/some-module[ some_object ]) |
Answered by
klmr
May 9, 2023
Replies: 1 comment 3 replies
|
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 |
3 replies
Answer selected by
dereckmezquita
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.:
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…