tidyverse / hms

A simple class for storing time-of-day values
https://hms.tidyverse.org/
Other
138 stars 25 forks source link

Conflict between `lubridate::hms` and `hms::hms` #55

Closed NikNakk closed 6 years ago

NikNakk commented 6 years ago

Depending on the order of package loading, hms may refer to either lubridate::hms or hms::hms, which have incompatible syntax and functionality. Since both are part of tidyverse, is this by design? I wasn't sure which package to post the issue in, so I've cross-posted at present (https://github.com/tidyverse/lubridate/issues/673). It's certainly a cause for confusion.

library(lubridate)
#Attaching package: ‘lubridate’
#The following object is masked from ‘package:base’:
#
#    date
library(hms)
#Attaching package: ‘hms’
#
#The following object is masked from ‘package:lubridate’:
#
#    hms
hms("11:23:00")
#Error: All arguments must be numeric or NA
library(hms)
library(lubridate)
#Attaching package: ‘lubridate’
#
#The following object is masked from ‘package:hms’:

#    hms

#The following object is masked from ‘package:base’:

#    date
hms("11:23:00")
#An object of class "Period"
#[1] 0
#Slot "year":
#[1] 0
#
#Slot "month":
#[1] 0
#
#Slot "day":
#[1] 0
#
#Slot "hour":
#[1] 11
#
#Slot "minute":
#[1] 23
krlmlr commented 6 years ago

Thanks. The collision is unfortunate, but there are ways around it.

tbuckl commented 5 years ago

sorry for the naive question, but it seems like i can't load both lubridate::hms and hms::hms without failing checks. is this by design?

i get the following serious warning:

Warning: replacing previous import ‘hms::hms’ by ‘lubridate::hms’ when loading ‘tidytransit’
krlmlr commented 5 years ago

In scripts, use the conflicted package to make your preference explicit.

github-actions[bot] commented 3 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.