hadley / emo

Easily insert emoji into R and RMarkdown
416 stars 53 forks source link

Reconsider imports #24

Open jimhester opened 7 years ago

jimhester commented 7 years ago

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?

LucyMcGowan commented 7 years ago

➕ 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 😂 )

romainfrancois commented 7 years ago

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 commented 7 years ago

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

perhaps this can be split into two 📦