The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
Author: Willem Sleegers License: MIT
tidystats is an R package for sharing and reporting statistics.
tidystats extracts statistics from the output of statistical functions
(e.g., t.test()
, lm()
) and stores them in a
structured format. The resulting file can be shared with others and used
in popular text editors to reproducibly report the statistics.
Please see below for instructions on how to install and use this package.
Do note that the package is currently in development. This means the package may contain bugs and is subject to significant changes. If you find any bugs or if you have any feedback, please let me know by creating an issue here on Github.
tidystats can be installed from CRAN.
install.packages("tidystats")
You can also install the development version from GitHub using the remotes
package.
::install_github("willemsleegers/tidystats") remotes
The main function is add_stats()
. The function has 2
necessary arguments:
list
: A list you want to add the statistics to.output
: The output of a statistics function (e.g., the
output of t.test()
or lm()
)You also need an identifier to uniquely identify the output of a
statistics function. You can provide an identifier (e.g.,
‘weight_height_correlation’) with the identifier
argument.
If you do not provide an identifer, one is automatically created for
you.
Optionally, you can also specify some additional meta-information:
type
: A type that specifies the analysis as primary,
secondary, or exploratory.preregistered
: Whether the analysis was preregistered
or not.notes
: Additional information you think is useful to
record.Once all statistics are added to the list, you can write the contents
to a file using the write_stats()
function.
The following example shows how to combine and save the statistics from three different statistical tests.
# Conduct a t-test, regression, and an ANOVA
<- reshape(
sleep_wide
sleep,direction = "wide",
idvar = "ID",
timevar = "group",
sep = "_"
)<- t.test(sleep_wide$extra_1, sleep_wide$extra_2, paired = TRUE)
sleep_test
<- c(4.17, 5.58, 5.18, 6.11, 4.50, 4.61, 5.17, 4.53, 5.33, 5.14)
ctl <- c(4.81, 4.17, 4.41, 3.59, 5.87, 3.83, 6.03, 4.89, 4.32, 4.69)
trt <- gl(2, 10, 20, labels = c("Ctl", "Trt"))
group <- c(ctl, trt)
weight <- lm(weight ~ group)
lm_D9
<- aov(yield ~ block + N * P * K, npk)
npk_aov
# Create an empty list to add the statistics to
<- list()
statistics
# Add the statistics and specify some meta-information
<- statistics |>
statistics add_stats(sleep_test, type = "primary") |>
add_stats(lm_D9, preregistered = TRUE) |>
add_stats(npk_aov, notes = "An ANOVA example")
# Save the statistics to a file
write_stats(statistics, "statistics.json")
The result is a .json file that contains all the statistics from the three statistical tests. If you want to see what this file looks like, you can inspect it here.
For a fully worked out example, see
vignette("introduction-to-tidystats")
.
tidystats supports functions from several statistics-related
packages, including stats, lme4, BayesFactor, emmeans, and others. For a
full list of supported packages and their functions, see
vignette("supported-functions")
.
In some cases you need provide a class
to the
add_stats()
function in order for tidystats to correctly
extract the statistics. You can see a list of functions that require the
class
argument in the documentation of the
add_stats()
function (?add_stats
).
If you want to use tidystats on an unsupported function, there are two things you can do:
add_stats()
using the custom_stats()
function.
See the vignette("custom-statistics")
for more
information.The file created with the write_stats()
function can be
used in several text editor add-ins to reproducibly report the
statistics. For more information on these add-ins, please see the tidystats website or their GitHub
pages:
See the tidystats website for more information, such as a FAQ, tips and tricks, as well as how to receive (and give) support.
If you have any questions or comments, feel free to create an issue here on GitHub or see the website for ways to contact me.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.