I am currently developing an R package and I want one of the functions to wrap a command-line tool to create an API to this tool. I am somewhat new to R package dev so I am running into a few issues that may be trivially easy for some of you to solve.
When I am using the terminal on my Mac and type 'which toolname' I am able to locate the path to the executable for a given tool. However, when I invoke the system() function in R, for example, system('which toolname'), the path is not found. I am assuming has to do with the PATH variable in my bash_profile which R does not seem to be finding/searching. Any idea how to get R to search PATH to find the CLI tool?
As a possible circumvention of this issue, I am considering having users of my package provide the path to the CLI tool manually, just once, and storing that path internally in the package for future use. Is it possible to have a function that takes a path to an executable as an argument and then stores the path internally so that it can be called each time the package is loaded?
Thank you for your help.