У меня есть несколько функций в скрипте, которые я хотел бы задокументировать с помощью # roxygen2, но сетевые ресурсы указывают на документирование функций в пакете. Я не хочу создавать пакет, а просто документирую свою пользовательскую функцию по мере продвижения. любые ресурсы будут полезны.
Я написал некоторые подробности о функции, используя синтаксис # roxygen2, и попытался задокументировать ее, но она возвращает «Ошибка: package.dir
должна содержать файл DESCRIPTION» и «Вы вызывали roxygenize()
в каталоге, который не является корнем пакета? "
Вот # примечания roxygen2
#'@title get_weather.
#'@description The function takes arguments of directory, country, station and year.
#'@param directory The directory where the weather data is stored relative to the working.
#'@param country The country where the data was recorded
#'@param station The weather station number.
#'@param year The year in which the data was recorded.
#'@return A data frame called WDATA. it contains data on vapour pressure(VP), wind speed (WN), precipitation (RAIN), daily total radiation (DTR) and daily average temperature (DAVTMP).
Вот функция, которую я хочу документировать
get_weather <-
function(directory="..\\weather\\",country="NLD",station="1",year="954"){
weather <-
matrix(data=as.numeric(unlist(scan(paste(directory,country,
station,".",year,sep=""), what=list("","","","","","","","",""),
comment.char='*',fill=TRUE,quiet=TRUE))),ncol=9)
RDD = as.vector(weather[-1,4])
TMMN = as.vector(weather[-1,5])
TMMX = as.vector(weather[-1,6])
WDATA <- data.frame(
VP = as.vector(weather[-1,7]),
WN = as.vector(weather[-1,8]),
RAIN = as.vector(weather[-1,9]),
DTR = RDD / 1e+03,
DAVTMP = 0.5 * (TMMN + TMMX)
)
}