I wrote a R function for my client which needs to pre-install some packages. To avoid any possible errors at my client's end, I would add some script lines in my function to test whether these required packages installed or not when my client runs it. If not, try to install any of them missed and require it automatically. For example, suppose the following simple function need to preinstall packages 'list("car","zoo","survival")`, how could I script for this purpose?
func<-function(x){
exp(x)
}