当前位置:网站首页>Rd file name conflict when extending a S4 method of some other package
Rd file name conflict when extending a S4 method of some other package
2022-07-03 19:30:00 【javail】
problem :
Actual question Practical problems
How do I avoid Rd file name conflicts when How to avoid Rd Filename conflict
- a S4 generic and its method(s) are not necessarily all defined in the same package (package containing (some of) the custom method(s) depends on the package containing the generic) and One S4 General and its methods ( One or more ) No need Are defined in the same package ( contain ( Part of the ) Custom method ( One or more ) The software package depends on including the general package ), and
- using
roxygenize()from package roxygen2 to generate the actual Rd files? Use the bag roxygen2 Mediumroxygenize()To generate the actual Rd file ?
I'm not sure if this is a roxygen2 problem or a common problem when the generic and its method(s) are scattered across packages (which IMHO in general definitely is a realistic use-case scenario if you follow a modular programming style). I'm not sure this is a roxygen2 The problem is also a common problem , When generics and their methods are scattered in packages ( If you follow the modular programming style , With all due respect, it must be a real use case scenario ).
What's the recommended way to handle these situations? What is the recommended way to deal with these situations ?
Illustration illustrations
In package pkga In the bag pkga
Suppose in package pkga you defined a generic method foo and that you've provided the respective roxygen code that roxygenize() picks up to generate the Rd file: Suppose in the package pkga You have defined a general method foo , You have provided roxygenize() Select the corresponding roxygen Code to generate Rd file :
#' Test function#' #' Test function.#' #' @param ... Further arguments.#' @author Janko Thyson \email{[email protected]@rappster.de}#' @example inst/examples/foo.R#' @docType methods#' @rdname foo-methods#' @exportsetGeneric( name="foo", signature=c("x"), def=function( x, ... ) { standardGeneric("xFoo") })When roxygenizing() your package, a file called foo-methods.Rd is created in the man subdirectory that serves as the reference Rd file for all methods that might be created for this generic method. When roxygenizing() Packet time , Will be in man Create a subdirectory named foo-methods.Rd The file of , This file serves as a reference to all methods that may be created for this generic method Rd file .So far so good. So far so good .If all of the methods for this generic are also part of your package, everything's good. If all the common methods are also part of your package , Everything is fine .For example, this roxygen code would make sure that documentation is added to foo-methods.Rd for the ANY -method of foo : for example , this roxygen The code will ensure that the file is added to foo-methods.Rd by ANY Of - Method foo :
#' @param x \code{ANY}.#' @return \code{TRUE}.#' @rdname foo-methods#' @aliases foo,ANY-method#' @exportsetMethod( f="foo", signature=signature(x="ANY"), definition=cmpfun(function( x, ... ) { return(TRUE) }, options=list(suppressAll=TRUE)))However, if package pkga provides the generic for foo and you decide in some other package (say pkgb ) to add a foo -method for x being of class character , then R CMD check will tell you that there is a name clash with respect to Rd file names and/or aliases (as there already exists a Rd file foo-methods.Rd in pkga ): however , If the bag pkga by foo Provides universal , And you decide on other packages ( such as pkgb ) In Chinese, it means x For the class character add to foo -method, that R CMD check Will tell you that there is a name conflict related to it Rd File name and / Or alias ( Because in pkga Already exists Rd file foo-methods.Rd ):
In package pkgb In the bag pkgb
#' @param x \code{character}.#' @return \code{character}.#' @rdname foo-methods#' @aliases foo,character-method#' @exportsetMethod( f="foo", signature=signature(x="character"), definition=cmpfun(function( x, ... ) { return(x) }, options=list(suppressAll=TRUE)))To be more precise, this is the error that's thrown/written to file 00install.out To be more exact , This is a throw / write file 00install.out
Error : Q:/pkgb/man/foo-methods.Rd: Sections \title, and \name must exist and be unique in Rd filesERROR: installing Rd objects failed for package 'pkgb'Due dilligence responsible investigation
I tried to change the values for @rdname and @aliases to foo_pkgb* (instead of foo* ), but \\title and \\name still are set to foo when roxygenizing and thus the error remains. I tried to put @rdname and @aliases The value of is changed to foo_pkgb* ( instead of foo* ), But when roxygenizing when , \\title and \\name Still set to foo , So mistakes still exist stay .Any ideas besides manually editing the Rd files generated by roxygenize() ? Except for manual editing roxygenize() Generate Of Rd Outside the file Any idea ?
EDIT 2012-12-01 edit 2012-12-01
In light of starting the bounty, the actual question might get a slightly broader flavor: Start with the bounty , Practical problems may become broader :
How can we implement some sort of an "inter-package" check with respect to Rd files and/or how can we consolidate S4 method help files scattered across packages into one single Rd file in order to present a single source of reference to the end-user? How do we target Rd Files implement some kind of “ Private Room ” Check and / Or how we can distribute the S4 Method help files are merged into a single Rd In file , To provide a single reference source for the end - user ?
Solution :
Reference resources : https://stackoom.com/en/question/t7lo边栏推荐
- Day11 ---- 我的页面, 用户信息获取修改与频道接口
- 2020 intermediate financial management (escort class)
- 第一章:三位阶乘和数,图形点扫描
- 2022-06-28 网工进阶(十三)IS-IS-路由过滤、路由汇总、认证、影响ISIS邻居关系建立的因素、其他命令和特性
- Go home early today
- We have built an intelligent retail settlement platform
- 04 -- QT OpenGL two sets of shaders draw two triangles
- Why should we do feature normalization / standardization?
- Chapter 1: recursively find the factorial n of n!
- Web Security (VIII) what is CSRF attack? Why can token prevent csdf attacks?
猜你喜欢
![CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析](/img/70/6fd00146418e5d481e951d51428990.png)
CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析

Chapter 20: y= sin (x) /x, rambling coordinate system calculation, y= sin (x) /x with profile graphics, Olympic rings, ball rolling and bouncing, water display, rectangular optimization cutting, R que

Think of new ways
![[proteus simulation] a simple encrypted electronic password lock designed with 24C04 and 1602LCD](/img/51/209e35e0b94a51b3b406a184459475.png)
[proteus simulation] a simple encrypted electronic password lock designed with 24C04 and 1602LCD

第一章:求所有阶乘和数,大奖赛现场统分程序设计,三位阶乘和数,图形点扫描,递归求n的阶乘n!,求n的阶乘n!,舍罕王失算

Analysis of dart JSON encoder and decoder

第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)
![第二章:基于分解的求水仙花数,基于组合的求水仙花数, 兰德尔数,求[x,y]内的守形数,探求n位守形数,递推探索n位逐位整除数](/img/c5/0081689817700770f6210d50ec4e1f.png)
第二章:基于分解的求水仙花数,基于组合的求水仙花数, 兰德尔数,求[x,y]内的守形数,探求n位守形数,递推探索n位逐位整除数

This Chinese numpy quick look-up table is too easy!

I study database at station B (4): DQL
随机推荐
Use unique_ PTR forward declaration? [repetition] - forward declaration with unique_ ptr? [duplicate]
[leetcode] [SQL] notes
Xctf attack and defense world crypto master advanced area olddriver
Summary of 90 day learning materials and notes of Zhang Fei's actual electronic hardware engineer
PR 2021 quick start tutorial, material import and management
Ctrip will implement a 3+2 work system in March, with 3 days on duty and 2 days at home every week
Yolov3 network model building
第一章:递归求n的阶乘n!
If the warehouse management communication is not in place, what problems will occur?
Zhang Fei hardware 90 day learning notes - personal record on day 5. Please see my personal profile / homepage for the complete record
EGO Planner代码解析bspline_optimizer部分(3)
P3402 persistent and searchable
03 -- QT OpenGL EBO draw triangle
Cross compile opencv with contrib
math_ Taylor formula
PR FAQ: how to set PR vertical screen sequence?
PR 2021 quick start tutorial, how to create a new sequence and set parameters?
2022-06-30 網工進階(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】
Chapter 1: find the factorial n of n!
第一章:三位阶乘和数,图形点扫描