[R] system() and R 1.7

Benjamin.STABLER@odot.state.or.us Benjamin.STABLER at odot.state.or.us
Fri Apr 18 20:04:48 CEST 2003


I am using the system(command, input=a character vector) command on a
Windows NT machine and I now get the following warning with R 1.7:

Warning message: 
the condition has length > 1 and only the first element will be used in: if
(input != "") { 

I think I am getting this warning because, according to Peter Dalgaard, R
1.7 now gives a warning if if() and while() are called with a vector
condition.  Is there anyway to fix this issue besides options(warn=-1)?
Thanks.

> system
function (command, intern = FALSE, wait = TRUE, input = "",
show.output.on.console = FALSE, 
    minimized = FALSE, invisible = FALSE) 
{
    f <- ""
    if (input != "") {
        f <- tempfile()
        on.exit(unlink(f))
        cat(input, file = f, sep = "\n")
    }
    if (intern) 
        flag <- 3
    else {
        if (wait) 
            flag <- ifelse(show.output.on.console, 2, 1)
        else flag <- 0
    }
    if (invisible) 
        flag <- 20 + flag
    else if (minimized) 
        flag <- 10 + flag
    .Internal(system(command, as.integer(flag), f))
}
<environment: namespace:base>

Benjamin Stabler
Transportation Planning Analysis Unit
Oregon Department of Transportation
555 13th Street NE, Suite 2
Salem, OR 97301  Ph: 503-986-4104



More information about the R-help mailing list