【发布时间】:2018-04-07 13:04:21
【问题描述】:
我知道roxygen2::roxygenise() 或devtools::document() cane 用于从 .R 文件生成 .Rd 文件。
例如,如果 Test.R 如下
#' Add together two numbers
#'
#' @param x A number
#' @param y A number
#' @return The sum of \code{x} and \code{y}
#' @examples
#' add(1, 1)
#' add(10, 1)
add <- function(x, y) {
x + y
}
那么roxygen2::roxygenise()或devtools::document()的输出将是
% Generated by roxygen2 (3.2.0): do not edit by hand
\name{add}
\alias{add}
\title{Add together two numbers}
\usage{
add(x, y)
}
\arguments{
\item{x}{A number}
\item{y}{A number}
}
\value{
The sum of \code{x} and \code{y}
}
\description{
Add together two numbers
}
\examples{
add(1, 1)
add(10, 1)
}
但是,我对反之亦然感兴趣。我确实有 .Rd 我想将其转换为 .R 文件。有什么想法!
【问题讨论】:
-
感谢@BenBolker 指出 Rd2 roxygen R 包。如果您更改评论以回答其他用户,将不胜感激。谢谢