gpt4 book ai didi

r - 文档对象中未记录的参数

转载 作者:行者123 更新时间:2023-12-04 13:01:39 26 4
gpt4 key购买 nike

所以我正在尝试在 R 中构建我的第一个包,但是当我运行 check() 时出现错误,我不确定如何修复。

我得到的错误是:

Undocumented arguments in documentation object 'monthly.rainR' ‘database’

Functions with \usage entries need to have the appropriate \alias entries, and all their arguments documented. The \usage entries must correspond to syntactically valid R code.



我看过哈德利的书,并尝试了一些我在网上找到的建议......但似乎没有一个解决方案有效

roxygen2 文档如下所示:
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Simple.stats_rainR.R
\name{monthly.rainR}
\alias{monthly.rainR}
\title{Stand alone monthly rain plots:}
\usage{
monthly.rainR(database)
}
\value{
12 monthly average rainfall plots
}
\description{
Stand alone monthly rain plots:
}
\examples{
rain4 = load_rain()
monthly.rainR(rain4)
}

我的monthly.rain() 函数如下所示:
#' Stand alone monthly rain plots:
#'
#' @return 12 monthly average rainfall plots
#' @export
#'
#' @examples
#' rain4 = load_rain()
#' monthly.rainR(rain4)

monthly.rainR = function(database){

# Seperate by Month:
# avm <- matrix(rain_month$rainfall[1:1932], ncol = 12, byrow = TRUE)
avm <- matrix(database$r_month$rainfall[1:1932], ncol = 12, byrow = TRUE)
# Compute annual average:
avb <- seq(0,length = 161)
for(y in 1:161){avb[y] = mean(avm[y,])}

# Put monthly averages and annual average in a matrix:
avmb = cbind(avm, avb)

# Plot 12 panels on the same figure:
plot.new()
timeyr = database$r_year$year
par(mar=c(1,1,1,1))
par(mfrow = c(6,2)) # 4 rows & 3 cols
par(mgp = c(2,1,0))

for(i in 1:12){
plot(timeyr, avmb[,i], type = "l", ylim = c(10,190),
xlab = "Year", ylab = "Rainfall",
main = paste("month is", i, split = ""))
lm.rainR.monthly <- lm(avmb[,i] ~ timeyr)
abline(lm.rainR.monthly, col="red")

}

}

我是编写包的新手,所以我不确定这里发生了什么。任何建议都会很棒。

最佳答案

定义后

# ' @param 

# ' @return

关于r - 文档对象中未记录的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55400398/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com