Skip to content

Bug report in foreign library (PR#13425)

4 messages · Peter Dalgaard, Nicholas Horton, Brian Ripley

#
here appears to be a bug in the foreign library.  The following code used to
work, but now generates an error when 'package="SAS"' is specified:

ds <- read.csv("http://www.math.smith.edu/sasr/datasets/help.csv")
# running foreign package version 0.8-30
library(foreign)
# this works fine
write.foreign(ds, "foo", "bar", package="Stata")
# this yields an error
write.foreign(ds, "foo", "bar", package="SAS")
# Error in writeForeignSAS(df = list(id = c(1L, 2L, 3L, 4L, 5L, 6L, 7L,  :
#  object "dfn" not found



There appears to be a space between < and - in foreign:::writeForeignSAS on
or around line 15:

dfn < - df

        should be

dfn <- df

<<insert bug report here>>



--please do not edit the information below--

Version:
 platform = i386-apple-darwin8.11.1
 arch = i386
 os = darwin8.11.1
 system = i386, darwin8.11.1
 status = 
 major = 2
 minor = 8.1
 year = 2008
 month = 12
 day = 22
 svn rev = 47281
 language = R
 version.string = R version 2.8.1 (2008-12-22)

Locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

Search Path:
 .GlobalEnv, package:foreign, package:stats, package:graphics,
package:grDevices, package:utils, package:datasets, package:methods,
Autoloads, package:base

Nicholas Horton 
Department of Mathematics and Statistics, Smith College
Clark Science Center, Northampton, MA 01063-0001
http://www.math.smith.edu/~nhorton
#
nhorton at email.smith.edu wrote:
That's one version ahead of the package in the 2.8.1 source tarball. Did 
you upgrade or is the darwin binary out of sync?
Yep. That is in 0.8-30 but not in -29...

  
    
#
Peter,

I run "update.packages()" regularly and may well have gotten this as a
result. Alas, I don't log the results very carefully.

All the best,

Nick
On 1/3/09 6:46 PM, "Peter Dalgaard" <p.dalgaard at biostat.ku.dk> wrote:

            
Nicholas Horton 
Department of Mathematics and Statistics, Smith College
Clark Science Center, Northampton, MA 01063-0001
http://www.math.smith.edu/~nhorton
#
On Sat, 3 Jan 2009, Nicholas Horton wrote:

            
Yes 0.8-30 is an update on the Mac OS X distribution.  It was deliberately 
put out after 2.8.1 as we knew that some of the options were little tested 
(we neither have access to some of the 'foreign' programs nor test 
examples for many of the features).

In this case you could downgrade by re-installing the binary, or fix the 
sources and re-install.  The SVN archive has been updated, but I do not 
intend to put out a new release until I get some responses from those who 
reported bugs in 0-8-29 and have been asked to test if the bug is fixed.