Bug 17219

Summary: str(x,1) prints out extra '... [list output truncated]'
Product: R Reporter: Neal Fultz <nfultz>
Component: MiscAssignee: R-core <R-core>
Status: CLOSED FIXED    
Severity: enhancement CC: maechler
Priority: P5    
Version: R 3.3.*   
Hardware: All   
OS: All   

Description Neal Fultz 2017-02-01 21:44:06 UTC
The truncation message should only be shown when str is actually used recursively. Right now, it prints out even when max.level is specified. For example: 

> str(loadTQF,1)
List of 75
 $ /home/nfultz/drive/tqf//DataSet100.xml           :List of 7
 $ /home/nfultz/drive/tqf//DataSet101.xml           :List of 3
 $ /home/nfultz/drive/tqf//DataSet102.xml           :List of 17
 $ /home/nfultz/drive/tqf//DataSet103.xml           :List of 798
  .. [list output truncated]
 $ /home/nfultz/drive/tqf//DataSet104.xml           :List of 3
 $ /home/nfultz/drive/tqf//DataSet105.xml           :List of 3
 $ /home/nfultz/drive/tqf//DataSet106.xml           :List of 17
 $ /home/nfultz/drive/tqf//DataSet107.xml           :List of 52
 $ /home/nfultz/drive/tqf//DataSet108.xml           :List of 334
  .. [list output truncated]
 $ /home/nfultz/drive/tqf//DataSet109.xml           :List of 31

This ought to be fixable by moving the line in str.default:

   if (list.len < le) 
                cat(indent.str, "[list output truncated]\n")

up inside the previous if block.
Comment 1 Martin Maechler 2017-02-02 15:18:39 UTC
Thank you.  Indeed your proposition solves the problem.