emo icon indicating copy to clipboard operation
emo copied to clipboard

Reconsider imports

Open jimhester opened this issue 6 years ago • 3 comments

Prior to recent changes this package imported only tibble, which made it small package that could be easily included in other R packages as a nice simple interface to emojis.

It now depends on 10 packages including extremely heavy ones such as dplyr and stringr. This makes it a non-starter to use in a package.

If these dependencies are only used in some functions they could potentially be moved to Suggests, or perhaps the new functionality would be better off in a new package aimed more towards end users?

jimhester avatar Aug 14 '17 20:08 jimhester

➕ I agree with this! From playing with it this week, I think we could probably get away with reducing back down to just tibble and glue (and maybe purrr). (I really ❤️ that tibble always autocorrects to nibble 😂 )

LucyMcGowan avatar Aug 14 '17 21:08 LucyMcGowan

sure, some of it is laziness, perhaps some can be moved to data-raw time dependency, e.g. there's no real need for dplyr in clock

function(time){
  hour   <- as.numeric( format(time, "%I") )
  minute <- as.numeric( format(time, "%M") )

  x <- round( 1 + 2*hour %% 12 + minute / 30 ) %% 24

  data <- emo::jis %>%
    filter( subcategory == "time", str_detect(name, "(o’clock|thirty)") ) %>%
    slice(x)

  structure( data$emoji, time = time, data = data,  class = c("clock", "emoji" ) )

}
<environment: namespace:emo>

the filter + slice can definitely be done sooner

romainfrancois avatar Aug 15 '17 11:08 romainfrancois

though it might get worse with additional things like #12 which I think would be cool.

perhaps this can be split into two 📦

romainfrancois avatar Aug 15 '17 11:08 romainfrancois