Add content to the element of an Rd object or fragment at a given position
Add content to the element of an Rd object or fragment at a given position.
append_to_Rd_list(rdo, x, pos)
an Rd object
the content to append, an Rd object or a list of Rd objects.
position at which to append
The element of
rdo at position
pos is replaced by its
x. The result keeps the "Rd_tag" of
pos may specify a position at any depth of the Rd
This function is relatively low level and is mainly for use by other functions.
Georgi N. Boshnakov
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
rdoseq <- utils:::.getHelpFile(help("seq")) iusage <- which(tools:::RdTags(rdoseq) == "\\usage") # append a new line after the last usage line rdoseq2 <- append_to_Rd_list(rdoseq, list(Rdo_newline()), iusage) # then append a new usage statement, in this case for another function rdoseq2 <- append_to_Rd_list(rdoseq2, list(Rdo_Rcode("sequence()")), iusage) Rdo_show(rdoseq2) # the two operations can be done in one step rdoseq3 <- append_to_Rd_list(rdoseq, list(Rdo_newline(), Rdo_Rcode("sequence()")), iusage) Rdo_show(rdoseq3) # now run reprompt to update the doc. # reports new argument "nvec" and updates the Rd object. # notice that the usage statement of sequence() is corrected # and an item for argument nvec is created. reprompt(rdoseq3, filename=NA)