4

There are two ggflags packages from github that I am currently using to display national flags with the same function of geom_flag. The difference between these two packages is that one display flags in rectangular form ("ellisp/ggflags") and the other in the round form ("rensa/ggflags").

My current solution is to devtools::install_github("ellisp/ggflags") when I switch to rectangular form, and devtools::install_github("rensa/ggflags") when switch to round shape. Although it works, I need repeatedly install those packages. Just wonder if there are alternatives to install both packages at the same time and to call the one needed, or any other options to let two packages co-exist on my machine.

Zhiqiang Wang
  • 6,206
  • 2
  • 13
  • 27
  • 3
    You could install to two different library paths. Just specify with `lib=`. And then set the path explicitly when you load the package via `library(, lib.loc=)`. But R wasn't meant to support two different packages with the same name (this is something CRAN would enforce) so things are messy. – MrFlick Nov 16 '20 at 05:06
  • 2
    Also this existing question may help with loading them https://stackoverflow.com/questions/24391251/import-as-in-r (but you'll still need a separate library location) – MrFlick Nov 16 '20 at 05:08
  • 2
    Don't know if that would be kosher, but I would just take the code from both of them and put them into your own package, and change the function names to `geom_flag_rect()` and `geom_flag_round()`. – Phil Nov 16 '20 at 05:08
  • @Phil Thank you. I have not done this before, but will try it. – Zhiqiang Wang Nov 16 '20 at 05:44

0 Answers0