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 4 files.

newModule(name, path, open, unitTests)
"newModule"(name, path, open, unitTests)
"newModule"(name, open, unitTests)
"newModule"(name, path, unitTests)
"newModule"(name, unitTests)
"newModule"(name, path, open)
"newModule"(name, open)
"newModule"(name, path)
newModuleCode(name, path, open)
"newModuleCode"(name, path, open)
newModuleDocumentation(name, path, open)
"newModuleDocumentation"(name, path, open)
"newModuleDocumentation"(name, open)
"newModuleDocumentation"(name, path)
newModuleTests(name, path, open)
"newModuleTests"(name, path, open)
Character string. Your module's name.
Character string. Subdirectory in which to place the new module code file. The default is the current working directory.
Logical. Should the new module file be opened after creation? Default TRUE.
Logical. Should the new module include unit test files? Default TRUE. Unit testing relies on the testthat package.

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


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.


On Windows there is currently a bug in RStudio that it doesn't know what editor to open with file.edit is called (which is what moduleName does). This will return an error:

Error in editor(file = file, title = title) : argument "name" is missing, with no default

You can just browse to the file and open it manually.

  • newModule
  • newModule,character,character,logical,logical-method
  • newModule,character,character,logical,missing-method
  • newModule,character,character,missing,logical-method
  • newModule,character,character,missing,missing-method
  • newModule,character,missing,logical,logical-method
  • newModule,character,missing,logical,missing-method
  • newModule,character,missing,missing,logical-method
  • newModule,character,missing,missing,missing-method
  • newModuleCode
  • newModuleCode,character,character,logical-method
  • newModuleDocumentation
  • newModuleDocumentation,character,character,logical-method
  • newModuleDocumentation,character,character,missing-method
  • newModuleDocumentation,character,missing,logical-method
  • newModuleDocumentation,character,missing,missing-method
  • newModuleTests
  • newModuleTests,character,character,logical-method
## Not run: 
#   ## create a "myModule" module in the "modules" subdirectory.
#   newModule("myModule", "modules")
# ## End(Not run)
Documentation reproduced from package SpaDES, version 1.2.0, License: GPL-3

Community examples

Looks like there are no examples yet.