SpaDES (version 1.3.1)

newModule: Create new module from template.


Autogenerate a skeleton for a new SpaDES module, a template for a documentation file, a citation file, a license file, a README.txt file, and a folder that contains unit tests information. The newModuleDocumentation will not generate the module file, but will create the other files.


newModule(name, path, ...)

# S4 method for character,character newModule(name, path, ...)

# S4 method for character,missing newModule(name, path, ...)



Character string specfying the name of the new module.


Character string. Subdirectory in which to place the new module code file. The default is the current working directory.


Additonal arguments. Currently, only the following are supported:

open. Logical. Should the new module file be opened after creation? Default TRUE.

unitTests. Logical. Should the new module include unit test files? Default TRUE. Unit testing relies on the testthat package.

type. Character string specifying one of "child" (default), or "parent".

children. Required when type = "parent". A character vector specifying the names of child modules.


Nothing is returned. The new module file is created at path/name.R, as well as ancillary files for documentation, citation, license, readme, and unit tests folder.


All files will be created within a subfolder named name within the path.

See Also

Other module creation helpers: newModuleCode, newModuleDocumentation, newModuleTests


Run this code
  ## create a "myModule" module in the "modules" subdirectory.
  newModule("myModule", "modules")

  ## create a new parent module in the "modules" subdirectory.
  newModule("myParentModule", "modules", type = "parent", children = c("child1", "child2"))
# }
# }

Run the code above in your browser using DataCamp Workspace