Description Usage Arguments Details Examples
Autogenerate an datastorr interface for a package. The idea is to run this function and save the resulting code in a file in your package. Then users will be able to download data and you will be able to relase data easily.
1 2 | autogenerate(repo, read, filename = NULL, name = basename(repo),
roxygen = TRUE)
|
repo |
Name of the repo on github (in username/repo format) |
read |
name of a function to read the data. Do not give the function itself! |
filename |
Name of the file to read. If not given, then the single file in a release will be read (but you will need to provide a filename on upload). If given, you cannot change the filename ever as all releases will be assumed to have the same filename. |
name |
Name of the dataset, used in generating the functions. If omitted the repo name is used. |
roxygen |
Include roxygen headers for the functions? |
In addition to running this, you will need to add datastorr
to the Imports:
section of your DESCRIPTION. To upload
files you will need to set your GITHUB_TOKEN
environment
variable. These steps will be described more fully in a vignette.
More complete instructions:
Let pkg
be basename(repo
); the name of the package
and of the GitHub repository.
First, create a new R package, e.g. devtools::create(pkg)
.
Then, copy the result of running autogenerate
into a file
in that package, e.g.
1 2 3 | writeLines(autogenerate(repo, read),
file.path(pkg, "datastorr.R"))
devtools::document(pkg)
|
Create a new git repository for this package, and add all the files in the package, and commit.
On GitHub, create a repository for the package and push your code there.
At this point you are now ready to start making releases by
loading your package and running pkg::<name>_release()
.
1 2 3 4 5 | writeLines(autogenerate("richfitz/datastorr.example",
read = "readRDS", name = "mydata"))
writeLines(autogenerate("richfitz/datastorr.example",
read = "readRDS", name = "mydata",
roxygen = FALSE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.