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

get_section_contents: Defensive return in case developer forgot to include relevant sections #5

Open
SHAESEN2 opened this issue Oct 18, 2020 · 0 comments

Comments

@SHAESEN2
Copy link

When the developer of a function forgot to include sections 'Last updated by', 'Last modified by" it would be helpful to return an informative message eg return warning, return "Please update", "No information available".

A proposal

get_section_contents <- function(tag, block){
  tag_no <- which(grepl(pattern = tolower(tag), tolower(block)))
  retme <- gsub(pattern = "[[:space:]]^|[[:space:]]$", replacement = "",
       x = block[tag_no + 1])

  if (length(retme) == 0) return("No information available")
  else return(retme)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant