Installing latest version of RStudio from R

If you are like me, chances are that you update RStudio on a daily basis. Here is a small R script that automatically download and install the latest version of RStudio on your computer. Note this is for ubuntu64 based systems, but this can be easily modified for Windows or Mac platforms.

rstudio_ubuntu_daily_url <- ""

r <- readLines(curl::curl(rstudio_ubuntu_daily_url))

file <- regmatches(r, regexpr("https\\S+?deb", r))[1]

destfile <- paste("/tmp/", basename(file))

download.file(file, destfile = destfile)

cmd <- sprintf("dpkg -i %s", destfile)