roxy_obj: Builds the documentation in 'roxygen2' based on object...

Description Usage Arguments Value Author(s) Examples

Description

This function gets a function and writes the skeleton of the documentation in roxygen syntax. The call of this function assumes that the working directory is a package directory, that is, where DESCRIPTION file is.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
roxy_fun(
  object,
  file,
  export = TRUE,
  author,
  keywords,
  extra,
  editor,
  print = FALSE,
  append = FALSE,
  find_file = FALSE
)

roxy_data(
  object,
  file,
  source = NULL,
  keywords,
  author,
  extra,
  editor,
  print = FALSE,
  append = FALSE,
  find_file = FALSE
)

Arguments

object

An object that is a function.

file

character[1] An optional file name to write the documentation into. If it is not provided, the name of the function is used to name the file. If NA, no file is created and the documentation will be printed on console.

export

logical[1] If TRUE means that the function will be exported because the label @export will be added to the documentation. Only has effect for roxy_fun.

author

character[1] The author of the function to be assigned to the @author field.

keywords

character[>=1] Keywords to the function that will be assigned to the @keywords field.

extra

character[1] Additional information to be written, for example "@import lattice".

editor

character[1] A name of an editor to open the file after its creation. See edit for more details.

print

logical[1] If TRUE, prints the skeleton in the console.

append

logical[1] If TRUE the documentation is appended to the file informed.

find_file

logical[1] If TRUE, shows the absolute path to the file formatted for a call of find-file in Emacs LISP, so the file can be opened just typing C-x C-e at the end of the statement.

source

character[1] A string that is the source of the dataset. Only has effect for roxy_data.

Value

This function does not have return value. It only creates/modifies files and prints content.

Author(s)

Walmes Zeviani, walmes@ufpr.br.

Walmes Zeviani, walmes@ufpr.br.

Walmes Zeviani, walmes@ufpr.br.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
## Not run: 

#-----------------------------------------
# Using roxy_fun().

fun <- function(x, y, ...) {
    return(x + y)
}

file.remove("bla.R")
file.remove("fun.R")

roxy_fun(fun)
roxy_fun(fun, append = TRUE)

file.remove("fun.R")
roxy_fun(fun, find_file = TRUE)

file.remove("fun.R")
roxy_fun(fun, editor = "emacs")

roxy_fun(fun, file = NA)

file.remove("fun.R")
roxy_fun(fun, print = TRUE)

file.remove("fun.R")
roxy_fun(fun, export = FALSE)

file.remove("fun.R")
roxy_fun(fun, author = "Walmes Zeviani, \\email{walmes@ufpr.br}.")

roxy_fun(fun, file = "bla.R")

file.remove("bla.R")
roxy_fun(fun, file = "bla.R", extra = "@import lattice")

file.remove("fun.R")
roxy_fun(object = fun, editor = "emacs")


## End(Not run)

## Not run: 

#-----------------------------------------
# Using roxy_data().

s <- "Smith; Sanders (1234)"
file.remove("iris.R")
roxy_data(iris,
          print = TRUE,
          source = s,
          editor = "emacs",
          keywords = c("BLA", "BLU"),
          find_file = TRUE,
          extra = c("@docType dataset",
                    "@details bla bla bla"))


## End(Not run)

walmes/wzRfun documentation built on Aug. 10, 2021, 2:19 p.m.