Convert f_usage objects to text appropriate for usage sections in Rd files
Converts f_usage objects to text appropriate for usage sections in Rd files. Handles S3 methods.
1 2 3 4
an object from class
maximal width of text on a line
ignored; this argument is present for consistency with the
deparse_usage1 is internal function. For users
as.character is more convenient.
as.character.f_usage, a named
character vector of length one (the name is the function name).
deparse_usage, a named character vector with one entry for
the usage text for each function.
Georgi N. Boshnakov
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[]) deparse_usage1(utp[]) # same cat(deparse_usage1(utp[])) cat(as.character(utp[])) # same unlink(fnseq)