[R] bugs in system() handling long character strings??

Naoki Takebayashi ntakebay at bio.indiana.edu
Sat Dec 7 22:01:02 CET 2002


Hi,

system(cmd, intern=T) seems to have a problem when cmd returns a long
character string.

For example, if a file (/tmp/long.txt) contains a long string such as:

123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

There are 120 characters in this one line.

> junk <- system("cat /tmp/long", TRUE)
> junk
[1] "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"
[2] "0"
> nchar(junk[1])
[1] 118

So one long line get separated into two parts, and additionally 119-th
character is missing.

Is this a bug in R or am I missing something?

I tried this on R-1.6.1 on linux/alpha and linux/i386.

Thanks,
Naoki

Naoki Takebayashi     <ntakebay at bio.indiana.edu>
--- Dept. of Biology, Box 90338, Duke University, Durham, NC 27708-0338




More information about the R-help mailing list