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. > 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? My sessionInfo() is R version 2.8.0 (2008-10-20) i686-pc-linux-gnu locale: LC_CTYPE=en_US;LC_NUMERIC=C;LC_TIME=en_US;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=en_US;LC_PAPER=en_US;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US;LC_IDENTIFICATION=C 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 -- Kevin E. Thorpe Biostatistician/Trialist, Knowledge Translation Program Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.thorpe at utoronto.ca Tel: 416.864.5776 Fax: 416.864.6057
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: https://svn.r-project.org/R-packages/trunk/foreign> > > 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: > LC_CTYPE=en_US;LC_NUMERIC=C;LC_TIME=en_US;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=en_US;LC_PAPER=en_US;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US;LC_IDENTIFICATION=C > > 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 >
On Mon, 2 Feb 2009, Duncan Murdoch wrote:> 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: > > https://svn.r-project.org/R-packages/trunk/foreignYes, and there is a good reason. No less than 3 people reported problems in 0.8-29 without reproducible examples. When I releaseed 0.8-30, I asked them to test it. Despite reminders, I am still waiting for any answer, and will wait another week. It really is unhelpful to report problems and not be prepared to answer follow-up questions nor test solutions. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Prof Brian Ripley wrote:> On Mon, 2 Feb 2009, Duncan Murdoch wrote: > >> 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: >> >> https://svn.r-project.org/R-packages/trunk/foreign > > Yes, and there is a good reason. No less than 3 people reported > problems in 0.8-29 without reproducible examples. When I releaseed > 0.8-30, I asked them to test it. Despite reminders, I am still waiting > for any answer, and will wait another week. > > It really is unhelpful to report problems and not be prepared to answer > follow-up questions nor test solutions. >Well, I installed the new version, and my export to SAS worked. -- Kevin E. Thorpe Biostatistician/Trialist, Knowledge Translation Program Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.thorpe at utoronto.ca Tel: 416.864.5776 Fax: 416.864.6057