1. Learn
  2. /
  3. Courses
  4. /
  5. Creating R Packages

Exercise

The structure of an R package

You can use devtools to create the basic structure of an R package by using the create() function.

There are some optional arguments to this function but the main one that you will use is the path argument. You use this to specify where your package will be created and the name that your package will take.

If you want to create the package in your current working directory, as you often will, you just need to supply the name for the package. When naming your package remember to think about:

  • If the name is already taken by another package.
  • Whether the name makes it clear what the package does.

devtools is loaded in your workspace.

Instructions

100 XP
  • Use the create() function to create a new R package called datasummary.
  • Use the dir() function to see what files and directories are created in your package.