I accidentally got an object made by the function capture.output, which can be printed line by line, e.g.:
> print(xxx)
[1] "==============================================================================="
[2] "Initial design evaluation"
[3] ""
[4] "Initial OFV = 28.9197"
[5] ""
[6] "Initial design expected parameter "
However, when I tried to reproduce similar string vector, all the vector elements are printed on the same line. e.g.:
> a <- c('a','b','c','d','e')
> print(a)
[1] "a" "b" "c" "d" "e"
I cannot find any difference between them:
> length(a)
[1] 5
> length(xxx)
[1] 5
>
> class(xxx)
[1] "character"
> class(a)
[1] "character"
>
> typeof(xxx)
[1] "character"
> typeof(a)
[1] "character"
I am wondering what causes the distinctive behaviors in print.
I believe it is a matter of the available horizontal space in the console. In my machine, at least, whenever two of the vector elements to be printed are wide enough that you would not be able to fit the two of them in one row, all the elements in the vector are printed one on each line. I believe that is what that first long string of equal signs does in your xxx
vector. I could write the code I used to check this out, but it completely depends on the width of my console, so I don't think it would be useful to others.