Rdo2Rdf(rdo, deparse = FALSE, ex_restore = FALSE, file = NULL, rcode = TRUE, srcfile = NULL)
TRUE
escapes backslashes where
necessary.
NULL
or
"missing", the result is returned as a character vector.
NULL
, if file
is not NULL
. Otherwise the Rd
formatted text as a character vector.
In principle, this function should be redundant, since the
print
and as.character
methods for objects of class "Rd"
would be expected to do the job. I was not able to get the desired
result that way (the deparse
option to print
did not
work completely for me either).
Arguments ex_restore
and rcode
were added on an ad-hoc
basis. rcode
is more recent and causes the Rdo2Rdf
to
duplicate backslashes found in any element Rd_tag
-ed with
"RCODE". ex_restore
does the same but only for the examples
section. In effect, if rcode
is TRUE, ex_restore
is
ignored.
The initial intent of this function (and the package Rdpack as a whole
was not to refer to the Rd source file. However, there is some
flexibility in the Rd syntax that does not allow the source file to be
restored identically from the parsed object. This concerns mainly
backslahes (and to some extent curly braces) which in certain contexts
may or may not be escaped and the parsed object is the same. Although
this does not affect functionality, it may be annoying if the escapes
in sections not examined by reprompt
were changed.
If srcfile
is the name of a file, the file is parsed and the Rd
text of sections of rdo
that are identical to sections from
srcfile
is taken directly from srcfile
, ensuring that
they will be identical to the original.
# # this keeps the backslashes in "author" (see Note above)
# reprompt(infile="./man/Rdo2Rdf.Rd")
# # this output "author" preceded by one backslash only.
# reprompt(infile="./man/Rdo2Rdf.Rd", sec_copy = FALSE)
Run the code above in your browser using DataCamp Workspace