HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Program Files/R/R-4.4.0/library/foreign/tests/testEmpty.R
## regression test for PR#15346

library(foreign)

## The testEmpty.xpt dataset was created using the following code:
## library(SASxport)
## data(iris)
## write.xport(Iris1=iris[1:2,],    # two row dataset
##             empty=data.frame(),  # empty dataset
##             Iris2=iris[3:4,],    # two row dataset
##             file="testEmpty.xpt",
##             autogen.formats=FALSE # prevent autocreation of FORMATS dataset
##             )

## Test that lookup.xport retrieves all three datsets
empty.f <- lookup.xport(file="testEmpty.xpt")
empty.f
stopifnot(length(empty.f) == 3L)


dat.f <- read.xport(file="testEmpty.xpt")
dat.f
stopifnot(length(dat.f)==3)