create_dict_pkg: Create an R package

Description Usage Arguments Details Value Examples

View source: R/create_package.R

Description

Exports one or more word dictionaries as a standalone R package

Usage

1
create_dict_pkg(d, path, open = FALSE, rstudio = TRUE)

Arguments

d

Word dictionary created by dict

path

A path. If it exists, it is used. If it does not exist, it is created, provided that the parent path exists.

open

If TRUE, activates the new project

rstudio

If TRUE, calls use_rstudio() to make the new package or project into an RStudio Project. If FALSE and a non-package project, a sentinel .here file is placed so that the directory can be recognized as a project by the here or rprojroot packages.

Details

The created package is modelled off the extremely fast meanr package, which means it requires compilation but is extremely fast.

Value

Path to the newly created project or package, invisibly.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## create dict
d <- dict(list(
  pos = c("good", "great", "awesome"),
  neg = c("worst", "awful", "terrible")))

## create package path via temp directory
path_pkg <- file.path(tempdir(), "simpleexample")

## create R package featuring d
#create_dict_pkg(d, path_pkg)

## create txt vector to test package on
txt <- c("good great terrible terrible",
  "good", "good", "other", "awful",
  "awful", "good", "great", "terrible")

## use new package on txt
#simpleexample::score(txt)

mkearney/dict documentation built on Nov. 4, 2019, 6:59 p.m.