[Rd] Windows 2000 crash while using rbind (PR#8225)

Tom.Mulholland@dpi.wa.gov.au Tom.Mulholland at dpi.wa.gov.au
Thu Oct 20 08:47:01 CEST 2005


Windows 2000 reports that "Rgui.exe has generated errors and will be =
closed by Windows. You will need to restart the program." when using =
rbind.=20


 df1 <- data.frame(cbind(x=3D1, y=3D1:1000), fac=3Dsample(LETTERS[1:3], =
1000, repl=3DTRUE))
 df2 <- data.frame(cbind(x=3D1, y=3D1:10), fac=3Dsample(LETTERS[4:6], =
10, repl=3DTRUE))
 df3 <- data.frame(cbind(x=3D1, y=3D1:1000000), =
fac=3Dsample(LETTERS[1:3], 1000000, repl=3DTRUE))
 df4 <- rbind(df1,df2)
 df5 <- rbind(df2,df3)
=20
=20
Since this only happens intermittantly and appears to be related to the =
size of the objects I ran the following code.

sink("rbind test.txt")
df1 <- data.frame(cbind(x=3D1, y=3D1:10), fac=3Dsample(LETTERS[4:6], 10, =
repl=3DTRUE))
for (j in seq(100000,1000000,10000)){
 df2 <- data.frame(cbind(x=3D1, y=3D1:j), fac=3Dsample(LETTERS[1:3], j, =
repl=3DTRUE))
 print(j)
 df3 <- rbind(df2,df1)
 }
sink()

the output of rbind test.txt is
[1] 100000
[1] 110000
[1] 120000
...
[1] 510000
[1] 520000

I then ran=20


sink("rbind test 2.txt")
df1 <- data.frame(cbind(a =3D 1, b =3D 2, c =3D 3, d =3D 4, e =3D 5, f =
=3D 6, x=3D1, y=3D1:10), fac=3Dsample(LETTERS[4:6], 10, repl=3DTRUE))
for (j in seq(100000,1000000,10000)){
 df2 <- data.frame(cbind(a =3D 1, b =3D 2, c =3D 3, d =3D 4, e =3D 5, f =
=3D 6, x=3D1, y=3D1:j), fac=3Dsample(LETTERS[1:3], j, repl=3DTRUE))
 print(j)
 df3 <- rbind(df2,df1)
 }
sink()

which also stopped at 520000.

I tried to narrow down where the crash takes place but it would appear =
that it is a moving feast, however both pieces of code always stopped =
with the same number, somewhere around 520000.

> version
         _             =20
platform i386-pc-mingw32
arch     i386          =20
os       mingw32       =20
system   i386, mingw32 =20
status                 =20
major    2             =20
minor    2.0           =20
year     2005          =20
month    10            =20
day      06            =20
svn rev  35749         =20
language R=20

One of the examples that has failed for me looks like
pop <- rbind(om.tp[,c(6,2,4,5,3)],eas[,c(2,1,3,4,5)])


> str(om.tp[,c(6,2,4,5,3)])
`data.frame':   1001384 obs. of  5 variables:
 $ age5 : Factor w/ 18 levels "0 to 4","5 to 9",..: 1 1 1 1 1 2 2 2 2 2 =
...
 $ sex  : Factor w/ 2 levels "Females","Males": 1 1 1 1 1 1 1 1 1 1 ...
 $ lga  : Factor w/ 142 levels "Albany (C)","Armadale (C)",..: 21 21 21 =
21 21 21 21 21 21 21 ...
 $ count: num  7.33 7.45 7.05 6.31 5.71 ...
 $ year : Factor w/ 41 levels "2001","2002",..: 1 1 1 1 1 1 1 1 1 1 ...
> str(eas[,c(2,1,3,4,5)])
`data.frame':   25342 obs. of  5 variables:
 $ age5 : Factor w/ 18 levels "0 to 4","5 to 9",..: 1 1 1 1 1 1 1 1 1 1 =
...
 $ sex  : Factor w/ 2 levels "Females","Males": 2 2 2 2 2 2 2 2 2 2 ...
 $ lga  : Factor w/ 142 levels "Albany (C)","Armadale (C)",..: 1 2 3 4 5 =
6 7 8 9 10 ...
 $ count: num  1107 2163  532  294  479 ...
 $ year : Factor w/ 5 levels "1991","1996",..: 1 1 1 1 1 1 1 1 1 1 ...
> gc()
           used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells  3255820  87.0    6193578 165.4  5266303 140.7
Vcells 22096825 168.6   32770865 250.1 32114295 245.1

Tom Mulholland
Senior Demographer
Spatial Information and Research
State and Regional Policy
Department for Planning and Infrastructure
Perth, Western Australia
+61 (08) 9264 7936



More information about the R-devel mailing list