我可以在 r 文档中使用 markdown 语法,以便它们出现在我的帮助文件中吗?



我正在编写/尝试在R中为自创建包编写一些.Rd帮助文件,可以在以下Github链接中找到。在这里,我正在尝试为函数fit_2D编写帮助文件或.Rd文件。 我使用了一些在使用 R markdown 时学到的基本技巧,但不幸的是,它们似乎没有在.Rd帮助文件的代码中执行。

有什么方法可以在使用/编码时打开 Markdown 语法用法/识别.RD文件?

我的代码如下所示

name{fit_2D}
alias{fit_2D}
%- Also NEED an 'alias' for EACH other topic documented here.
title{
Iteratively fits 2D regression models to a dataset using the function code{fit_2D(func, dat, it, op_v)}
}
description{
The function, code{fit_2D}, takes four arguments, **func**, **dat**, **it**, **op_v** and fits the *2D* model described by the argument **func** into the data described by the argument **dat**. The parameter **it** describes the number of iterations that the code generates before it decides to declare that the starting/intial values of the vector to be iterated, **op_v**, is a bad starting point to search for a local minima within the given number of iterations, **it**. In such cases the message *solution did not converge* will be displayed. **op_v** is a vector comprising the initial values/guess point from where the vector will iterate itself to look for a local minima. It must however be remembered that the function, code{fit_2D}, does not have pre-defined default values attached to its arguments and also that the function **does not** under present circumstances support optimization algorithms with *constraints* defined on them. This however is a work in progress and will be taken care of in future contexts.
}
usage{
fit_2D(func, dat, it, op_v)
}
%- maybe also 'usage' for other objects documented here.
arguments{
item{func}{
The argument code{func} is a R function. It defines the model that the user wants to fit to his data defined in the argument code{dat}. The argument has certain rules and restrictions.
1. The argument code{func} has to be a user-defined function itself
2. The function that the user passes to the argument code{func} must itself be a function that accepts only one argument. This argument must be the vector that needs to be iterated, code{op_v}.
3. The vector code{op_v} must be defined after the definition of the function that is to be passed in code{func}, failing which, the argument passed in code{func} ceases to be a function and this would throw an error. *See example below*
4. The function has to return a value, **y**. *See example below*
}

我希望代码能够将y解析为粗体,但这不会发生。另外,我不能像在这里使用的那样使用代码环境。有没有办法告诉 R-Studio 在我的.Rd文件中使用 markdown?或者是否有单独的语法列表用于在.Rd文件中编码。我更愿意将 markdown 解析集成到我的.Rd文件中,因为它让我的生活更轻松,因为我之前有一些经验。我对R非常陌生,尤其是软件包创建,在这一点上,任何帮助都是最值得赞赏的。

不,Rd 文件有自己的语法,比 Markdown 更接近 LaTeX(但它不是 LaTeX)。 该语法记录在 R 附带的编写 R 扩展手册中。 解析器的更多技术细节记录在 http://developer.r-project.org/parseRd.pdf 中。

一两年前有一个项目,编写一个允许输入 Markdown 语法的解析器;我不知道它的地位。

如果您使用 Roxygen(将帮助文本放在 .R 文件),我相信如果启用它可以接受 Markdown 语法。

最新更新