You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

R包检查报错:family/concept条目引发多索引项问题及解决

R包检查报错原因及解决方法

问题背景

我在R包中添加了两个数据集的文档注释,运行包检查时出现错误,不清楚问题出在哪。

原始注释代码

#' Diagnosis to Condition Code Mapping file
#'
#' @family AHRQ
#'
#' AHRQ DX Condition Codes.
#'
#' @docType data
#' @name dx_cc_mapping
#' @usage data(dx_cc_mapping)
#' @format A data frame with 86852 rows and 5 variables
"dx_cc_mapping"

#' Procedure to Condition Code Mapping file
#'
#' @family AHRQ
#'
#' AHRQ Px Condition Codes.
#'
#' @docType data
#' @name px_cc_mapping
#' @usage data(px_cc_mapping)
#' @format A data frame with 79721 rows and 5 variables
"px_cc_mapping"

报错信息

Found the following \keyword or \concept entries
which likely give several index terms:
File 'dx_cc_mapping.Rd':
\concept{AHRQ

AHRQ DX Condition Codes.}

File 'px_cc_mapping.Rd':
\concept{AHRQ

AHRQ Px Condition Codes.}

错误原因

@family标签会被转换为Rd文档中的\concept索引条目,原始代码里@family AHRQ之后的空行和后续描述文本被错误合并到了\concept内容中,导致一个\concept包含了多个语义的内容,不符合Rd文档对索引术语需单一明确的要求,因此触发了检查错误。

解决方法

给两个数据集分别设置唯一的@family名称,避免后续文本被误解析到\concept中。修改后的代码如下:

#' Diagnosis to Condition Code Mapping file
#'
#' @family AHRQ_Dx
#' @docType data
#' @name dx_cc_mapping
#' @usage data(dx_cc_mapping)
#' @format A data frame with 86852 rows and 5 variables
"dx_cc_mapping"

#' Procedure to Condition Code Mapping file
#'
#' @family AHRQ_Px
#' @docType data
#' @name px_cc_mapping
#' @usage data(px_cc_mapping)
#' @format A data frame with 79721 rows and 5 variables
"px_cc_mapping"

内容的提问来源于stack exchange,提问作者MCP_infiltrator

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 13:31:19