[Rd] system(..., intern=TRUE) splits long lines (PR#2623)

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Mar 11 09:29:48 MET 2003


vograno at arbitrade.com writes:

> system(..., intern=TRUE) splits long lines after 118th character and
> discards the 119th character 
> 
> > a <- paste(rep("a", 124), collapse="")
> > system(paste("echo", a), intern=TRUE)
> system(paste("echo", a), intern=TRUE)
> [1]
> "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaa"
> 
> > 
> 
> The result is a vector of length 2 and it should be that of 1.

> major    1                
> minor    6.0              

Not so in 1.6.2:

> a <- paste(rep("a", 124), collapse="")
> system(paste("echo", a), intern=TRUE)
[1]
> "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

You might at least have checked the NEWS file for 1.6.2:

    o   system(intern=TRUE) has an undocumented line length limit of
        119 chars both on Unix and Windows.  The limit is now 8096 and
        documented.  On Unix (only) every 120th character used to be
        discarded.



-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907



More information about the R-devel mailing list