Companion to "Learning Statistics with R"

A collection of tools intended to make introductory statistics easier to teach, including wrappers for common hypothesis tests and basic data manipulation. Accompanies the textbook "Learning Statistics with R: A Tutorial for Psychology Students and Other Beginners" by Navarro.


lsr

CRANstatus Codecov testcoverage

lsr is a companion package to the textbook Learning Statistics with R. It provides beginner-friendly wrappers for common statistical procedures — t-tests, chi-square tests, effect sizes, correlation matrices, and basic data manipulation — with output designed to be readable by students encountering statistics for the first time.

Example

Here is an independent-samples t-test comparing extra sleep between two drug groups in the built-in sleep dataset:

library(lsr)
independentSamplesTTest(formula = extra ~ group, data = sleep)
#> 
#>    Welch's independent samples t-test 
#> 
#> Outcome variable:   extra 
#> Grouping variable:  group 
#> 
#> Descriptive statistics: 
#>                 1     2
#>    mean     0.750 2.330
#>    std dev. 1.789 2.002
#> 
#> Hypotheses: 
#>    null:        population means equal for both groups
#>    alternative: different population means in each group
#> 
#> Test results: 
#>    t-statistic:  -1.861 
#>    degrees of freedom:  17.776 
#>    p-value:  0.079 
#> 
#> Other information: 
#>    two-sided 95% confidence interval:  [-3.365, 0.205] 
#>    estimated effect size (Cohen's d):  0.832

Compared to base R’s t.test(), the output labels every component in plain English and automatically reports Cohen’s d alongside the test result.

Where to go next

  • Guided overview — a hands-on introduction for students and beginners, working through descriptive statistics, reshaping data, and hypothesis testing with a single example dataset.
  • Critical commentary — an honest account of the package’s limitations and pointers to better tools for users who have outgrown it.
  • Reference — documentation for all 29 functions, organised by topic.

Installation

Install the released version from CRAN:

install.packages("lsr")

Or the development version from GitHub:

# install.packages("devtools")
devtools::install_github("djnavarro/lsr")

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("lsr")

1.0.0 by Danielle Navarro, 3 months ago


https://github.com/djnavarro/lsr, https://lsr.djnavarro.net/


Report a bug at https://github.com/djnavarro/lsr/issues


Browse source code at https://github.com/cran/lsr


Authors: Danielle Navarro [aut, cre] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports graphics, grDevices, methods, stats

Suggests knitr, rmarkdown, testthat, tibble, withr


Imported by calms, coursekata, noisemodel, superb.

Depended on by AOboot.


See at CRAN