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

Provide function text to create_tool_def #227

Closed
vorpalvorpal opened this issue Dec 18, 2024 · 2 comments
Closed

Provide function text to create_tool_def #227

vorpalvorpal opened this issue Dec 18, 2024 · 2 comments

Comments

@vorpalvorpal
Copy link

Writing a package is a whole lot of overhead that most R users never try. So a lot of people using create_tool_def will have a function with a roxygen documentation that is not registered as part of a package. It would be nice to be able to provide a copy pasted version of the function to create_tool_def. I would personally have thought that it would be nice to provide the function as text to the first argument, but given topic already accepts function names as strings, that might be messy (although create_tool_def could perhaps test to see if the string has any spaces in it to disambiguate between function names and definitions). Another possibility is another argument or refactor create_tool_def into two different functions, one of which takes function names and one of which takes function definitions.

@jcheng5
Copy link
Collaborator

jcheng5 commented Dec 18, 2024

If the function has roxygen documentation and is in a file you have sourced, then create_tool_def(funcname) should work just fine, even if you're not writing a package. This is how I generally use it. (Or am I misunderstanding your request?)

@vorpalvorpal
Copy link
Author

Ah, yes, that worked. I'd just run the functions in the console to make them available in the global environment, but not actually sourced the file. Maybe it needs to be made clear in the docs how do use this with your own functions.

Thanks!

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

2 participants