Convert f_usage objects to text appropriate for usage sections in Rd files

Description

Converts f_usage objects to text appropriate for usage sections in Rd files. Handles S3 methods.

Usage

1
2
3
4
deparse_usage(x)
deparse_usage1(x, width = 72)
## S3 method for class 'f_usage'
as.character(x, ... )

Arguments

x

an object from class f_usage

width

maximal width of text on a line

...

ignored; this argument is present for consistency with the generic as.character

Details

deparse_usage1 is internal function. For users as.character is more convenient.

Value

For deparse_usage1 and as.character.f_usage, a named character vector of length one (the name is the function name).

For deparse_usage, a named character vector with one entry for the usage text for each function.

Author(s)

Georgi N. Boshnakov

See Also

pairlist2f_usage and pairlist2f_usage1

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
cur_wd <- getwd()
setwd(tempdir())

# as for prompt() the default to save in current dir as "seq.Rd".
fnseq <- reprompt(seq)

# let's parse the saved Rd file
rdoseq <- parse_Rd(fnseq)

# the usage of 'seq' has several entries, parse them all

ut <- get_usage_text(rdoseq)
cat(ut,"\n")

utp <- parse_usage_text(ut)

# format some of them
as.character(utp[[1]])
deparse_usage1(utp[[1]])  # same

cat(deparse_usage1(utp[[2]]))
cat(as.character(utp[[2]]))   # same


unlink(fnseq)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.