We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to separate the Percent calculation below into two separate derived calculations?
library(pivottabler) pt <- PivotTable$new() pt$addData(mtcars) pt$addColumnDataGroups("am") pt$addRowDataGroups("vs") pt$addRowDataGroups("mpg", totalCaption= "Subtotal") pt$addRowDataGroups("disp", addTotal=FALSE) # basic calculation pt$defineCalculation(calculationName="CountVal", summariseExpression="n()", visible=FALSE) # get column totals filterOverrides <- PivotFilterOverrides$new(pt, keepOnlyFiltersFor="am") pt$defineCalculation(calculationName="CountAll", summariseExpression="n()", filters=filterOverrides, visible=FALSE) # percentage of column calculation total pt$defineCalculation(calculationName="Percent", caption="Percent", type="calculation", basedOn=c("CountVal", "CountAll"), calculationExpression="paste0(values$CountVal, ' (', sprintf('%.1f %%', values$CountVal/values$CountAll*100), ')')") pt$renderPivot()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is it possible to separate the Percent calculation below into two separate derived calculations?
The text was updated successfully, but these errors were encountered: