This is an example to download and install an external program / software within R.
dotRcheck <- function(){
#Check for audiolyzR installation
directory<-getwd()
if (.Platform$OS.type=="windows"){
ANSWER <- readline("Do you want to install Graphviz for path diagram generation? \nType y or n\n")
if (substr(ANSWER,1,1)=="y"){
tmpdir <- getwd()
destfile<-paste(tmpdir, "graphviz-2.30.1.msi", sep="/")
download.file("http://www.graphviz.org/pub/graphviz/stable/windows/graphviz-2.30.1.msi", destfile=destfile)
shell(paste("msiexec /a ",destfile))
}
}
}