如何使用或转义@符号,以便可以在R软件包文档中使用它?

问题描述 投票:1回答:1

@是R文档中的特殊字符,那么如何在文档中使用文字@

我尝试使用单,双,三和四反斜杠。但是没有运气。

示例

#' @importFrom utils file.edit
#'
#' @export
#'
#' @examples
#' library(dplyr)
#' medium("https://medium.com/@data_datum/ggplot2-or-how-to-make-fancy-graphics-with-r-fabae7fc16d4")
#'

在上面的示例中,URL中的@将导致语法错误

r r-package roxygen2 roxygen
1个回答
2
投票

@符号加倍。即将@替换为@@

即更改

#' medium("https://medium.com/@data_datum/ggplot2-or-how-to-make-fancy-graphics-with-r-fabae7fc16d4")

to

#' medium("https://medium.com/@@data_datum/ggplot2-or-how-to-make-fancy-graphics-with-r-fabae7fc16d4")

请参见另一个示例here

© www.soinside.com 2019 - 2024. All rights reserved.