简体   繁体   English

在 R 编程或 R 降价中使用@?

[英]Use of @ in R programming, or R markdown?

I've downloaded code from another programmer, and they have the following:我从另一个程序员那里下载了代码,他们有以下内容:

#' @param gr                a GRanges of regions/DMRs/whatever
#' @param HMM               a GRanges with ChromHMM annotations (name, itemRgb)
#' @param background        a null distribution (universe) whence gr was chosen
#' @param footprint         compute BP footprints instead of number of overlaps?
#' 
#' @return                  a data.frame with overlap frequency and color code
#'
#' @export

I recognize the #' as syntax from knitr spin.我将 #' 识别为 knitr spin 的语法。 But I don't understand how it's being used here or what the @ symbol is doing.但我不明白它在这里是如何使用的,也不明白@符号在做什么。 Please explain.请解释。

The #' part is designating that this is part to be woven into proper R documentation through R package roxygen2 . #'部分表示这是通过 R 包roxygen2编入适当的 R 文档的roxygen2 The @param are telling the translator to make these things into elements of the documentation. @param告诉翻译者把这些东西变成文档的元素。

Example you posted will create a help file which will ultimately be viewed as您发布的示例将创建一个帮助文件,该文件最终将被视为

functionName(gr, HMM, background, footprint)

under Usage section of ?functionName and description of each argument under section Arguments and so on... See the link @joran provided (and stackoverflow tag description ) about all available tags you can use to guide the way this inline documentation is made into a full blown .Rd file.?functionName Usage 部分和 Arguments 部分下每个参数的描述下...请参阅@joran 提供的链接(和stackoverflow 标签描述),了解所有可用标签,您可以使用这些标签来指导如何将此内联文档制作成完整的 .Rd 文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM