How to use roxygen2 to print documentation of self defined function?

44 Views Asked by At

I define a function called avglist in R and would like to print the documentation of avglist using ?avglist or help(avglist), but they both failed.

library(roxygen2)

#' Function:avglist
#' 
#' Calculate the average of numbers within a range
#' 
#' This function computes the average of all numbers in a list that within
#' a specified range
#' 
#' @param lst A list of numeric values
#' @param low The lower bound of the range (exclusive)
#' @param high The upper bound of the range (exclusive)
#' 
#' @return The average of numbers within the specified range
#' @export
#' 
avglist <- function(lst,low=0,high=100) {
  filtered_values <- lst[lst > low & lst < high]
  mean(filtered_values)
}

when I run the code, system showed this:

error message

And when I tried ??avglist, it showed this: help screenshot

Does anyone know how to print out the documentation of avglist?

0

There are 0 best solutions below