Install package CHAID is throwing error saying package or namespace load failed for 'libcoin'

Hi, when I try to install CHAID using - install.packages("CHAID", repos="http://R-Forge.R-project.org"), it is throwing me the following error:

  • installing source package 'CHAID' ...
    ** using staged installation
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    converting help for package 'CHAID'
    finding HTML links ... done
    CHAID-package html
    USvote html
    chaid html
    REDIRECT:topic Previous alias or file overwritten by alias: C:/Users/ZoomRx/Documents/R/win-library/4.1/00LOCK-CHAID/00new/CHAID/help/chaid.html
    ** building package indices
    ** testing if installed package can be loaded from temporary location
    *** arch - i386
    Error: package or namespace load failed for 'libcoin' in library.dynam(lib, package, package.lib):
    DLL 'mvtnorm' not found: maybe not installed for this architecture?
    Error : package 'libcoin' could not be loaded
    Error: loading failed
    Execution halted
    *** arch - x64
    ERROR: loading failed for 'i386'
  • removing 'C:/Users/ZoomRx/Documents/R/win-library/4.1/CHAID'
    Warning in install.packages :
    installation of package ‘CHAID’ had non-zero exit status

It seems you are missing the mvtnorm package, try installing it first.

install.packages("mvtnorm")

Also, you have the 32-bit R version installed, if you don't actually need this version (which is rare this days), I recommend you to uninstall it to avoid having to compile packages for two architectures unnecessarily.