Are paths with hyphens supported; if so how to use it and if not why not? #320
-
Simple question I have paths with hyphens in them like so: box::use(../some-path/to-a-file/some-module[ some_object ]) |
Beta Was this translation helpful? Give feedback.
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 |
Beta Was this translation helpful? Give feedback.
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…