2

I am fairly new to R and having some issues installing the foreign package. I get the following message:

package ‘foreign’ is not available (for R version 3.6.3) 

from the following line of code:

install.packages('foreign')

Can anyone help? Thanks!

stefan
  • 90,330
  • 6
  • 25
  • 51
  • Related: https://stackoverflow.com/questions/25721884/how-should-i-deal-with-package-xxx-is-not-available-for-r-version-x-y-z-wa – Matt May 20 '20 at 20:41
  • 2
    This package was recently updated after R went live with R version 4.0. I suggest trying to update your R version to 4.0 and see if it works. – dvd280 May 20 '20 at 21:26

2 Answers2

8

You could update to R version 4. For R version 3, there are several options using version 0.8-76. You could install from source:

 install.packages("https://cran.r-project.org/src/contrib/Archive/foreign/foreign_0.8-76.tar.gz")

Alternatively, you could use an old binary. For Windows:

install.packages("https://cran.r-project.org/bin/windows/contrib/3.6/foreign_0.8-76.zip")

And for Mac:

install.packages("https://cran.r-project.org/bin/macosx/el-capitan/contrib/3.6/foreign_0.8-76.tgz")
Mark Clements
  • 120
  • 1
  • 5
-3

You can click on Tools then Install Packages.. write foreign then click Install.

Kian
  • 110
  • 7