Skip to content

Instantly share code, notes, and snippets.

@baptiste
Created October 15, 2014 19:45
Show Gist options
  • Save baptiste/b4c1dcaaff53b8c1f625 to your computer and use it in GitHub Desktop.
Save baptiste/b4c1dcaaff53b8c1f625 to your computer and use it in GitHub Desktop.
ask.r
ask = function(msg){
h <- paste(capture.output(help(msg)), collapse="")
print(h)
if(nchar(msg) < 20){
m <- paste0(stringr::str_extract_all(h,"\\?")[[1]], collapse="")
Recall(m)
}
}
ask("???")
@baptiste
Copy link
Author

[1] "No documentation for ‘???’ in specified packages and libraries:you could try ‘?????’"
[1] "No documentation for ‘????????’ in specified packages and libraries:you could try ‘??????????’"
[1] "No documentation for ‘??????????????????’ in specified packages and libraries:you could try ‘????????????????????’"
[1] "No documentation for ‘??????????????????????????????????????’ in specified packages and libraries:you could try ‘????????????????????????????????????????’"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment