hadley / emo

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

Query not specific enough for `emo::flag` and other errors #64

Open matiasandina opened 2 years ago

matiasandina commented 2 years ago

The behavior of flag is not able to pattern match properly China

> emo::flag("Hong Kong SAR China")
🇭🇰
> purrr:::map(c("China","Hong Kong SAR China"), emo::flag)
Error in .f(.x[[i]], ...) : 
  Query not specific enough, found 3 flags: 'China', 'Hong Kong SAR China', 'Macau SAR China'
> purrr:::map(c("China"), emo::flag)
Error in .f(.x[[i]], ...) : 
  Query not specific enough, found 3 flags: 'China', 'Hong Kong SAR China', 'Macau SAR China'
> purrr:::map(c("china"), emo::flag)
Error in .f(.x[[i]], ...) : Cannot find flag 'china'  

The behavior of emo::ji is different and produces "expected" results. I get that they are internally implemented differently but if flag is meant as a shorthand, it might be better to not have it fail like this.

> emo::ji("china")
🇨🇳 
> emo::ji("China")
🇨🇳 
> emo::ji("Hong_Kong_SAR_China")
🇭🇰 

I am using, maybe this got fixed in next versions and I didn't check.

packageVersion("emo")
[1] ‘0.0.0.9000’