2

Using explicit namespaces sometimes makes R code more readable. For example, I prefer

lubridate::year(x)

to

library(lubridate)
# lots of code
year(x)

However, if I use the function year often, the first option requires much more typing, especially if the package name is rather long. Is it possible to abbreviate the namespace lubridate to, say, lbd so I can call

lbd::year(x)

This would save me some typing while writing the code, and at the same time give me a better indication of where year() comes from when I revisit the code later.

sieste
  • 8,296
  • 3
  • 33
  • 48

0 Answers0