Friday 9 March 2012

How to write on the same line in R?

You can achieve this by using the old trick of the carriage return '\r' and the command cat()

for ( i in 1:100){
    cat(c('\r   ',i))
}

Will print on the same line each number from 1 to 100

No comments: