Questions for R package development

I am new to devtools and usethis, please bear with me if I asked something stupid. I would like to build an internal package to have better management of my current project.
I have watched the introduction video but i have the following questions:

  1. From my understanding, one function will need to create one .R in the R folder, how do I use the other function within the package
  2. How to import other developing packages? for example, I have two developing projects, ProjectA and ProjectB. Project B's func_b() uses ProjectA's func_a() , how do I do that?
  3. how do I create global variables or use data within the package development?

Thank you.

I suggest you look at (simple) existing packages to get an idea what files you need to create, etc. E.g two of my quite small packages could be good examples:

If you want to put a data set in the package, see the appropriate section in the "R packages" book: R Packages (2e) - 7  Data

1 Like

Welcome to package development!

I gave a package development workshop earlier this week, here's the page with further resources Further resources :: Become an R Package Developer!

In particular

  1. regarding internal functions you might find the blog post "Internal functions in R packages" useful.
  2. regarding other packages see Chapter 13 Namespace | R Packages (that whole book is a great read! Note it's being improved cf activity in GitHub - hadley/r-pkgs: Building R packages)
  3. regarding data here's another blog post "How to distribute data with your R package".

You can still ask further questions on this forum, but I'd recommend having one question per forum topic, this way it's easier for folks to see at a glance whether they can help. Good luck!

This topic was automatically closed after 45 days. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.