What are some good patterns for development with packages that define the same function? In my case, lubridate
and data.table
both define wday
.
A naming conflict occurs when you try to create or use an identifier that was previously defined. In some cases, naming conflicts generate errors such as Ambiguous name detected or Duplicate declaration in current scope.
Packages are used in Java in order to prevent naming conflicts, to control access, to make searching/locating and usage of classes, interfaces, enumerations and annotations easier, etc.
It helps Java to achieve abstraction. Naming Conflicts occur when a class implements two interfaces that have methods and variables with the same name.
Packages are used in Java in-order to prevent naming conflicts, to control access, to make searching/locating and usage of classes, interfaces, enumerations.
You can use ::
, it helps to specify which package to use:
lubridate::wday
function (x, label = FALSE, abbr = TRUE)
UseMethod("wday")
<environment: namespace:lubridate>
data.table::wday
function (x)
as.POSIXlt(x)$wday + 1L
<environment: namespace:data.table>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With