パッケージをビルドしようとしていますが、正常に動作しますが、実行時に警告が表示されますR CMD check my.package
。
* checking Rd metadata ... WARNING
Rd files with duplicated alias 'show,whitetest-method':
'show-methods.Rd' 'whitetest-class.Rd'
私のパッケージは、ファイルに保存されている 1 つの関数のみで構成されていますname.R
。ただし、このname.R
ファイルでは、まず新しいクラス ( という名前) を作成し、そのクラスのメソッドをwhitetest
定義する必要があります。show
それは非常に単純で、次のようになります。
# Create the new class whitetest
setClass("whitetest", representation("list"))
# Specify the appearance of the output
setMethod("show", "whitetest", function(object) {
text1 <- "White's Test for Heteroskedasticity:"
cat(paste("\n", text1, "\n", sep = ""))
row <- paste(rep("=", nchar(text1)), collapse = "")
cat(row, "\n")
cat("\n")
cat(" No Cross Terms\n")
cat("\n")
cat(" H0: Homoskedasticity\n")
cat(" H1: Heteroskedasticity\n")
cat("\n")
cat(" Test Statistic:\n")
cat("", sprintf("%.4f", object$statistic), "\n")
cat("\n")
cat(" Degrees of Freedom:\n")
cat("", object$degrees, "\n")
cat("\n")
cat(" P-value:\n")
cat("", sprintf("%.4f", object$p.value), "\n")
})
次に、このファイルに対してpackage.skeleton()
コマンドを実行します。name.R
私のman
フォルダでは、ファイルshow-methods.Rd
とファイルwhitetest-class.Rd
が問題の原因となっています。show-methods
ファイルの最初の行は次のとおりです。
\name{show-methods}
\docType{methods}
\alias{show-methods}
\alias{show,whitetest-method}
whitetest-class
ファイルの最初の行は次のとおりです。
\name{whitetest-class}
\Rdversion{1.1}
\docType{class}
\alias{whitetest-class}
\alias{show,whitetest-method}
これらが警告の原因であることはわかりましたが、一体どうすればこれを回避できますか?