当前位置:网站首页>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边栏推荐
- Compared with 4G, what are the advantages of 5g to meet the technical requirements of industry 4.0
- Today I am filled with emotion
- Chapter 2: find the box array, complete number in the specified interval, and improve the complete number in the specified interval
- Pecan — @expose()
- Valentine's Day - make an exclusive digital collection for your lover
- CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析
- Read the paper glodyne global topology preserving dynamic network embedding
- 交叉编译Opencv带Contrib
- P3402 persistent and searchable
- These problems should be paid attention to in the production of enterprise promotional videos
猜你喜欢
Chapter 1: sum of three factorials, graph point scanning
Chapter 2: find the box array, complete number in the specified interval, and improve the complete number in the specified interval
Chapter 1: seek common? Decimal and S (D, n)
Counting from the East and counting from the West will stimulate 100 billion industries. Only storage manufacturers who dare to bite the "hard bone" will have more opportunities
BUUCTF
[water quality prediction] water quality prediction based on MATLAB Fuzzy Neural Network [including Matlab source code 1923]
01. Preparation for automated office (free guidance, only three steps)
[leetcode] [SQL] notes
Bright purple crystal meso tetra (4-aminophenyl) porphyrin tapp/tapppt/tappco/tappcd/tappzn/tapppd/tappcu/tappni/tappfe/tappmn metal complex - supplied by Qiyue
Chapter 1: extend the same code decimal sum s (D, n)
随机推荐
I didn't cancel
Octopus online ecological chain tour Atocha protocol received near grant worth $50000
2022-06-30 网工进阶(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】
QT -- qfileinfo file information reading
Use unique_ PTR forward declaration? [repetition] - forward declaration with unique_ ptr? [duplicate]
Flume learning notes
Common text labels
Chapter 1: King Shehan miscalculated
Ego planner code parsing Bspline_ Optimizer section (2)
OSPF - detailed explanation of stub area and full stub area
[water quality prediction] water quality prediction based on MATLAB Fuzzy Neural Network [including Matlab source code 1923]
Merge K ascending linked lists
BOC protected phenylalanine zinc porphyrin (Zn · TAPP Phe BOC) / iron porphyrin (Fe · TAPP Phe BOC) / nickel porphyrin (Ni · TAPP Phe BOC) / manganese porphyrin (Mn · TAPP Phe BOC) Qiyue Keke
Win10 share you don't have permission
Pecan - route
Streaming media server (16) -- figure out the difference between live broadcast and on-demand
Thinking about festivals
2022-07-02 advanced network engineering (XV) routing policy - route policy feature, policy based routing, MQC (modular QoS command line)
第二章:4位卡普雷卡数,搜索偶数位卡普雷卡数,搜索n位2段和平方数,m位不含0的巧妙平方数,指定数字组成没有重复数字的7位平方数,求指定区间内的勾股数组,求指定区间内的倒立勾股数组
Analysis of dart JSON encoder and decoder