Hello,
Situation
I don't wish to write require(lubridate) in my package. However, not doing so results in an error.
Error & Reproducible Example
In a brand new R session.
lubridate::as.period(x = 10, unit = 'day')
#> Error in get(as.character(FUN), mode = "function", envir = envir): object 'days' of mode 'function' was not found
In a brand new R session.
library('lubridate')
#>
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#>
#> date
lubridate::as.period(x = 10, unit = 'day')
#> [1] "10d 0H 0M 0S"
Why is this behavior true?
Background
I'm writing a package which uses the lubridate::as.period function and would like to make a call like:
historic_timeperiod <- lubridate::as.period(30, units='days')
(In the package, lubridate is set as Imports:)
Version Information
R version 3.3.3 (2017-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RevoUtilsMath_10.0.0 RevoUtils_10.0.3 RevoMods_11.0.0 MicrosoftML_1.3.0 RevoScaleR_9.1.1
[6] lattice_0.20-34 rpart_4.1-10
loaded via a namespace (and not attached):
[1] codetools_0.2-15 lubridate_1.6.0 CompatibilityAPI_1.1.0 foreach_1.4.3 grid_3.3.3
[6] R6_2.2.0 jsonlite_1.3 magrittr_1.5 stringi_1.1.2 iterators_1.0.8
[11] tools_3.3.3 stringr_1.2.0 mrupdate_1.0.1
Hello,
Situation
I don't wish to write
require(lubridate)in my package. However, not doing so results in an error.Error & Reproducible Example
In a brand new R session.
In a brand new R session.
Why is this behavior true?
Background
I'm writing a package which uses the
lubridate::as.periodfunction and would like to make a call like:(In the package,
lubridateis set asImports:)Version Information