The goal of handcalcs is to make it easy for anyone who is teaching (or learning) statistics to have an easy way to generate solutions that show the step-by-step processes of solving the problems by hand.
The basic unit is the set of solve_*
functions. These functions will
calculate a specific statistical outcome from the arguments, and return
a list that includes not just the final calculated value (and all
interim calculated values), but also a LaTeX string that shows the steps
by which that value was calculated. This allows for easy generation of
statistics problem sets along with their solutions.
There are two options to handling rounding behavior.
round_interim
: Raw data values, and all interim calculations are rounded to this number of decimal places.round_final
: The final calculated value is rounded to this number of decimal places. This rounded value is what is returned as part of the list. However, the value that is displayed as part of the LaTeX solution string is intentionally presented such that additional digits past zero are not displayed if they are not needed. For instance, in calculating the mean of 5 and 7, ifround_final = 4
, the solution would display this as 6 instead of 6.0000. The number of digits displayed takes into consideration the number of digits past the decimal in both the raw values and the final calculated value, using the largest number of digits (up to the value ofround_final
) necessary to preserve the calculations. For instance, in calculating the mean of 5.25 and 7.75, it would display as 6.50 instead of 6.5 because there are two digits past the decimal in the original data.
You can install the development version of handcalcs from GitHub with:
# install.packages("devtools")
devtools::install_github("tarball11/handcalcs")