Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for family of functions to be identified #7

Open
RobertASmith opened this issue Jan 22, 2024 · 0 comments
Open

Allow for family of functions to be identified #7

RobertASmith opened this issue Jan 22, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@RobertASmith
Copy link
Contributor

RobertASmith commented Jan 22, 2024

Nathan Green at UCL is developing the rocletCHEERs package which allows users to reference specific CHEERS checklist items in Roxygen code for functions. This would mean for example that a function that relates to discounting of costs and benefits would have: @cheers discounting in the roxygen2 code. The benefit of this is having a summary of which functions relate to each item on the checklist.

We want to utilize this functionality in our table, adding the cheers checklist from these tags as a column. For example:

function_name package test_path cheers_item
x y z w

The problem is that we currently identify functions at the function call, not the function definition. Therefore we would need an algorithm to do one of the following:

  1. for each function, search for the function definition, which will always start with function_name <- function( or function_name = function(. Look at the roxygen code for the function and locate @cheers and then take the remaining words on that line.

  2. just search the code-base for @cheers and each time this string appears identify the function below it. For example in the below we would want to return a list where the element uncertainty contains the function name example_foo.

#' Example Function
#'
#' Description
#'
#' @param param1 Description of Param 1
#' @param param2 Description of Param 2
#' @param param3 Description of Param 3
#'
#' @cheers uncertainty
#'
#' @return what it returns
#'
#' @examples
#' \dontrun{
#'  example_foo()
#' }
#'
example_foo <- function(param1, param2, param3) {
  
<some code>

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant