append_to_Rd_list {Rdpack} | R Documentation |
Add content to the element of an Rd object or fragment at a given position.
append_to_Rd_list(rdo, x, pos)
rdo |
an Rd object |
x |
the content to append, an Rd object or a list of Rd objects. |
pos |
position at which to append |
The element of rdo
at position pos
is replaced by its
concatenation with x
. The result keeps the "Rd_tag" of
rdo[[pos]]
.
Argument pos
may specify a position at any depth of the Rd
object.
This function is relatively low level and is mainly for use by other functions.
the modified rdo
object
Georgi N. Boshnakov
#rdoseq <- utils:::.getHelpFile(help("seq")) rdoseq <- Rdo_fetch("seq", "base") iusage <- which(tools:::RdTags(rdoseq) == "\\usage") iusage attr(rdoseq[[iusage]], "Rd_tag") ## append a new line after the last usage line rdoseq2 <- append_to_Rd_list(rdoseq, list(Rdo_newline()), iusage) ## Suppose that we wish to describe the function 'sequence' in the same Rd file. ## We append an usage statement for 'sequence()', without worrying about its ## actual signature. 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 rdoseq3, namely: ## (1) it corrects the signature of 'sequence' in section \usage. ## (2) reports new argument "nvec" ## (3) inserts \item for the new argument(s) in section \arguments. reprompt(rdoseq3, filename=NA)