https://github.com/abicky/packager
Import R scripts as a package
https://github.com/abicky/packager
Last synced: about 1 year ago
JSON representation
Import R scripts as a package
- Host: GitHub
- URL: https://github.com/abicky/packager
- Owner: abicky
- Created: 2013-09-01T00:54:40.000Z (almost 13 years ago)
- Default Branch: develop
- Last Pushed: 2013-09-01T00:56:55.000Z (almost 13 years ago)
- Last Synced: 2025-04-12T06:37:57.434Z (about 1 year ago)
- Language: R
- Size: 109 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
packageR -- Import R scripts as a package
=========================================
Description
-----------
This package provides a mechanism to import R scripts as a package, in other words, with namespace.
Installation
------------
First, install `namespace` package used in `packageR`.
$ Rscript -e 'install.packages("namespace")'
Then, clone the repository and install the package.
$ git clone git@github.com:abicky/packageR.git
$ R CMD INSTALL packageR
Usage
-----
import(files, as)
See also `?import`
You have to call `export` function to export the variables in the specified scripts like below:
f <- function() print("function f")
export(f)
Examples
--------
files <- system.file("examples", c("public.R", "private.R"), package = "packageR")
import(files, "foo")
# exported function
foo::f()
# unexported function
foo:::.f()
unloadNamespace("foo")