Getting a New R Package–#SQLNewBlogger

Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

I was trying to test an R script the other day and got this:

> library(randomForest)
Error in library(randomForest) : 
  there is no package called ‘randomForest’

A common error if you have just a base R installation. In my case, I’d installed R Studio, but nothing else. I knew that many packages are installed at CRAN, but I’d never gotten one. So I did.

The first step was a quick google for syntax. In this case, r-bloggers.com had a nice short piece. The install.packages() function is used.

I decided to just try it. In may case, I was happy to use the defaults for now. I ran:

> install.packages("randomForest")
Installing package into ‘E:/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://mran.revolutionanalytics.com/snapshot/2016-11-01/bin/windows/contrib/3.3/randomForest_4.6-12.zip'
Content type 'application/zip' length 177208 bytes (173 KB)
downloaded 173 KB

package ‘randomForest’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\Steve\AppData\Local\Temp\RtmpUl3h6d\downloaded_packages

After that, my library() function ran fine.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.