Is it possible to run a command during package install?

My package uses webshot and phantomjs. I would like the package to run the command webshot::install_phantomjs during install so that the user doesn't have to do it.

Is this possible?

Thanks in advance!

Found solution above.

Apparently there is no way to execute code during installation, but there are hooks for package load or attachment.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

I am sorry for the late answer. For the record, there are several ways to run code during installation, one is to use a configure script. E.g. this is how you would run an R script: purrr/configure at f67f77134cd258fced27834595c4091f49be62e1 · tidyverse/purrr · GitHub

OTOH for your use case it might be better to supply a function in the package that can download and install the external software. There are several examples for this in CRAN packages, e.g. webshot::install_phantomjs() is one.