2

I'm making a personal package and would like to load a css file in one of the functions in this package in order to have a "default style". What is the optimal way of doing this?

I cannot find any documnetation that helps me understand how to work with external data like a css file, mostly what I find is about exporting external datasets to be loaded separately, etc.

automa7
  • 494
  • 4
  • 15
  • 1
    I this for a shiny app or something? I think the best fit would be putting it in the `extdata` folder then you can easily access it within the pacakge: http://r-pkgs.had.co.nz/inst.html – MrFlick Dec 14 '18 at 18:12
  • Yes! At first I tried putting it into the extdata folder, but was mistakenly calling it directly instead of using `system.file()`, so it wasn't working. Thanks for the doc page! – automa7 Dec 14 '18 at 18:18

1 Answers1

1

I found the problem. I was using the inst/extdata folder to export my style.css file, but was trying to read it directly in the code. Thanks to @MrFlick docpage, I found out I had to use the system.file() function in order to use the exported file.

automa7
  • 494
  • 4
  • 15