0

I'm creating an R package that references a static shapefile in one place and two png files. I've looked around for the last two hours to find an answer as to:

  1. Where to store these files. Do I just create a file called resources and reference that in the function? Because it didn't work when I tried.
  2. How to reference them in the functions I've created. I'm not sure I fully understand how the package calls external objects and how to go about referencing. For the path, I was typing in "../resources/object.png" and that wasn't working.

This is probably super easy for experienced package creators, but I figured I'd ask because I just can't figure it out.

Hanna
  • 69
  • 1
  • 10
  • Check out hadleys book (http://r-pkgs.had.co.nz/inst.html). You can put the objects into the `inst` directory. Check out the `system.file` function for referencing the objects. `system.file` is used to find files inside a package after its been installed – Conor Neilson Jun 16 '18 at 22:37
  • Thank you for this! Tried searching hadley's book, but I didn't know what to look for! Thanks for pointing me there. – Hanna Jun 16 '18 at 22:40
  • That and http://adv-r.had.co.nz/ are good references. I don't need them bookmarked, both my browser autofill and I remember them. – r2evans Jun 16 '18 at 22:52
  • @Hanna: Also see https://stackoverflow.com/a/13463722/143305 so maybe we can close this as a duplicate ... – Dirk Eddelbuettel Jun 16 '18 at 23:15

0 Answers0