[R] Problem with foreign package

Duncan Murdoch murdoch at stats.uwo.ca
Mon Feb 2 15:41:39 CET 2009

On 2/2/2009 8:46 AM, Kevin E. Thorpe wrote:
> I tried to use write.foreign() to export to SAS this morning and got an 
> error.
> When I looked at the code for writeForeignSAS() I saw this line:
> dfn < -df
> which I think should be
> dfn <- df
> So, I tried to run update.packages() to see if there was an updated 
> version and got the following result.

That bug was fixed a few weeks ago, but a new version has not been 
released yet.  You can get the latest source from svn:


>  > update.packages(c("foreign"))
> Warning message:
> In list.files(lib) : list.files: 'foreign' is not a readable directory
> I ran the above command as root.
> Is this because the foreign package is a core package and not a CRAN one?

It is a "recommended" package, which means it is on CRAN, but is also 
included in binary distributions of R.  But the reason you got that 
error is because update.packages() doesn't take a package name as the 
first arg, the first arg is lib.loc.  You need to answer the interactive 
questions if you don't want to update everything.

Duncan Murdoch

> My sessionInfo() is
> R version 2.8.0 (2008-10-20)
> i686-pc-linux-gnu
> locale:
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> loaded via a namespace (and not attached):
> [1] tools_2.8.0
> and my version of foreign is 0.8-30

More information about the R-help mailing list