make_prj_tree {rprojtree} | R Documentation |
make_prj_tree
Description
Create a files structure from a builtin template or from a customized template provided as .json file
Usage
make_prj_tree(json_str, file, path = ".", verbose = FALSE)
Arguments
json_str |
string with the name of the builtin template to use |
file |
string for the name of the .json file describing a customized files structure to use as template |
path |
string containing which directory to use as root of the files structure to create |
verbose |
logical, show or not info while creating the files structure |
Details
Only one of
json_str
orfile
must be supplied.An error is raised if any node in the .json structure is found malformed
JSON format:
All the nodes must have a
type
and aname
. Allowed types aredir
, for directories, andfile
for files.All the directory nodes can contain any number of sub-nodes for subdirectories
The file nodes can include a
content
field for the text the file should contain.
Value
invisible, an R list that corresponds to the JSON object in
json_str
, as returned by rjson::fromJSON
.
See Also
rprojtree::print_template
,
rprojtree::available_templates
,
rjson::fromJSON
Examples
## Not run:
root_path = "..."
make_prj_tree(json_str = "basic_template", path = root_path)
my_template <- ".../some_template.json"
make_prj_tree(file = my_template, path = root_path)
## End(Not run)