Skip to content
Prev 389036 / 398506 Next

Show only header of str() function

Hello,

I believe but do not have references that str was meant for interactive 
use, not for use in a script or package. If this is the case, then it 
should be rare to have to output to an object such as a character vector.

As for my solution, it is far from perfect, I try to avoid 
capture.output and, once again, limit its use to interactive R. It is 
overkill but I use it so few times that performance issues probably do 
not matter. It is sometimes a convenient way of solving an immediate 
problem and once done, move on.

As for the OP, Enrico's solution seems better, even with the 2nd printed 
line. Unless the 1st line is to be processed (?).

Hope this helps,

Rui Barradas

?s 17:32 de 02/09/21, Avi Gross via R-help escreveu: