Summary shown in R is short, many terms shown as "Other" -
how can display complete output summary, without classifying values "other"?
summary(d) date.of.sale city department product 1/18/2015 : 149 a:5290 footwear mens : 538 13245 : 255 1/25/2015 : 149 b:2078 home furnishing:1937 15350 : 255 11/23/2014: 149 c:5088 infant w-wear : 992 15352 : 255 11/30/2014: 149 ladies lower :1735 15353 : 255 12/14/2014: 149 ladies upper :1805 15355 : 255 12/21/2014: 149 mens lower :2039 15356 : 255 (other) :11562 mens upper :3410 (other):10926 sale predicted.sale flag 0 :3963 0 :3279 forecast: 1341 not available:1341 1 :1951 history :11115 1 :1145 2 : 946 2 : 797 3 : 700 3 : 557 4 : 572 4 : 498 5 : 438 (other) :4155 (other):4570
aside: looks data has factor columns should numeric. may want have @ may cause issues in later analysis.
as far call summary()
goes, can adjust maxsum
argument. find in help(summary)
can used change amount of information shown in summary
maxsum - integer, indicating how many levels should shown factors.
so let's have @ @ work two-column data frame example -
set.seed(12) df <- data.frame( = sample(letters[1:8], 1e3, true), b = sample(letters[1:10], 1e3, true) )
calling summary()
no other arguments, "other" listed @ bottom of each column summary.
summary(df) # b # d :132 g :118 # c :131 b :108 # f :131 e :106 # :123 f :104 # g :123 d :103 # e :122 j :103 # (other):238 (other):358
now if adjust maxsum
length of maximum number of unique values of columns, values listed.
summary(df, maxsum = max(lengths(lapply(df, unique)))) # b # a:123 a: 94 # b:120 b:108 # c:131 c: 99 # d:132 d:103 # e:122 e:106 # f:131 f:104 # g:123 g:118 # h:118 h: 92 # i: 73 # j:103
note maxsum
maxsum = length(reduce(union, df))
, , assumes working data frame.
Comments
Post a Comment