randomForest package in R

Discussion in 'CS2' started by j98, Sep 14, 2022.

  1. j98

    j98 Member

    The randomForest package (from the Ch21 core reading/PBOR) does not load in my version of R, and I get the error below. Is there any way around this? Also is there any chance it even comes up in the exam given that it's in the core reading but not in the list of packages here: here https://www.actuaries.org.uk/system/files/field/document/CS1 and CS2 Guide 2022 FINAL_2.pdf

    > install.packages("randomForest")
    WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

    https://cran.rstudio.com/bin/windows/Rtools/
    Installing package into ‘C:/Users/64211/Documents/R/win-library/4.0’
    (as ‘lib’ is unspecified)
    Warning in install.packages :
    package ‘randomForest’ is not available for this version of R

    A version of this package for your version of R might be available elsewhere,
    see the ideas at
    https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
    > library(randomForest)
    Error in library(randomForest) :
    there is no package called ‘randomForest’
     
  2. Andrew Martin

    Andrew Martin ActEd Tutor Staff Member

    Hi j98

    I can't completely guarantee what will be on the exam though I would be surprised if the exam required use of a package not on the list of required packages.

    Which version of R are you running? The guide specifies that you should be using any version of 4.0 or above.

    Andy
     
    pjlee01 likes this.
  3. j98

    j98 Member

    Hi Andy,

    I am using R 4.0.5
     
  4. Andrew Martin

    Andrew Martin ActEd Tutor Staff Member

    Hi j98

    Packages are regularly updated and are then sometimes no longer supported on older versions of R. It's possible that randomForest is no longer supported on 4.0.5. You could try downloading a later version of R.

    All the best

    Andy
     
    j98 likes this.

Share This Page