从 R 中的 pivottabler 库呈现的 Pivot Table 中删除小计和总计
Removing subtotals and totals from Pivot Table rendered by pivottabler library in R
我正在尝试使用库 (pivottabler).
在 R Studio 中重新创建一个像数据框一样的数据框 table
我几乎完全按照我想要的方式重新创建了它,但是当前呈现的默认数据透视表 tables 包括我需要删除的小计和总计。
有人会碰巧知道我可以在呈现的枢轴 table 中编辑行吗?
我是包的作者。
可以删除小计,如下面第七行所示:
library(pivottabler)
pt <- PivotTable$new()
pt$addData(bhmtrains)
pt$addColumnDataGroups("TrainCategory")
pt$addRowDataGroups("TOC", totalCaption="Grand Total") # << Change Total Caption
pt$addRowDataGroups("PowerType")
pt$addRowDataGroups("SchedSpeedMPH", addTotal=FALSE) # << Hide Total
pt$defineCalculation(calculationName="TotalTrains", summariseExpression="n()")
pt$renderPivot()
可以通过将枢轴 table 转换为基本 table 来对枢轴 Table 布局进行更多定制编辑 - 请参阅“结果作为基本tabler Table”标题在“5.Outputs”小插图中,也可用 here。
我正在尝试使用库 (pivottabler).
在 R Studio 中重新创建一个像数据框一样的数据框 table我几乎完全按照我想要的方式重新创建了它,但是当前呈现的默认数据透视表 tables 包括我需要删除的小计和总计。
有人会碰巧知道我可以在呈现的枢轴 table 中编辑行吗?
我是包的作者。
可以删除小计,如下面第七行所示:
library(pivottabler)
pt <- PivotTable$new()
pt$addData(bhmtrains)
pt$addColumnDataGroups("TrainCategory")
pt$addRowDataGroups("TOC", totalCaption="Grand Total") # << Change Total Caption
pt$addRowDataGroups("PowerType")
pt$addRowDataGroups("SchedSpeedMPH", addTotal=FALSE) # << Hide Total
pt$defineCalculation(calculationName="TotalTrains", summariseExpression="n()")
pt$renderPivot()
可以通过将枢轴 table 转换为基本 table 来对枢轴 Table 布局进行更多定制编辑 - 请参阅“结果作为基本tabler Table”标题在“5.Outputs”小插图中,也可用 here。