Julian
Julian

Reputation: 791

pander using only necessary number of rows in splitted summaries? (eg. when having Factors)

Is there any way of having pander using only the necessary amount of rows in splitted summary-tables (instead of always using the maximum number of rows)?

This issue arises when there is a summary of a data.frame having for example numeric and logic columns: The numeric column needs 6 or 7 rows (depending on wether there are NAs or not), the logic column only 3.

df <- data.frame(a=1:10,
                 b=c(TRUE,TRUE,FALSE,TRUE,TRUE,FALSE,TRUE,TRUE,FALSE,FALSE))
summary(df)

Output:

        a             b          
 Min.   : 1.00   Mode :logical  
 1st Qu.: 3.25   FALSE:4        
 Median : 5.50   TRUE :6        
 Mean   : 5.50   NA's :0        
 3rd Qu.: 7.75                  
 Max.   :10.00  

Now, if I pander this, the empty rows get padded as NA, since class(summ) is c("summaryDefault", "table"). This can be avoided by setting missing to "", but then there are empty rows. This is OK if the summary is not splitted, but if the summary is splitted it happens that there are only empty rows in one block, which takes space and doesn't look good.

pander (summary( df),missing="",split.table = 20 )

Output:

-------------
      a      
-------------
Min.  : 1.00 

1st Qu.: 3.25

Median : 5.50

 Mean : 5.50 

3rd Qu.: 7.75

Max.  :10.00 
-------------

Table: Table continues below


-------------
      b      
-------------
Mode :logical

   FALSE:4   

   TRUE :6   

   NA's :0   




-------------

Upvotes: 1

Views: 80

Answers (0)

Related Questions