Skip to content

Companion to "Learning Statistics with R"

5packages depend
119.9Kdownloads / year
82.9%test coverage
8/13flavors OK

Overview

About

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.

Changes in 1.0.0

Bug fixes

  • correlate(): when a pair of variables had too few complete observations for cor.test() to run, the entire call would abort. The affected cell is now left as NA and the remaining pairs are computed normally.
  • correlate(), goodnessOfFitTest(), associationTest(): the internal options(warn = 2) used to intercept warnings was not guarded with on.exit(), so an unexpected error could leave the session's global warn level permanently elevated. All three functions now use on.exit() to guarantee restoration.
  • cramersV(): Yates' continuity correction was applied by default for 2×2 tables (inherited from chisq.test()), causing V to be less than 1 even for perfectly associated tables. Cramér's V is now always computed from the Pearson chi-squared (no continuity correction), giving results on the correct 0-to-1 scale.
Show all changes in 1.0.0Hide the rest of the changes in 1.0.0
  • goodnessOfFitTest(), associationTest(): when a factor variable had unused levels, the extra levels were silently included in the test with zero observed cases, changing degrees of freedom and p-values without any indication. Both functions now issue an informative warning when unused levels are detected, with a suggestion to call droplevels().
  • modeOf(), maxFreq(): all-NA or zero-length input produced a cryptic base-R "no non-missing arguments to max" warning and returned empty output. Both functions now issue an informative warning and return NA.
  • wideToLong(): when no column names contained the separator string, the error came from deep inside stats::reshape() with no hint that the cause was a naming-convention mismatch. The function now checks for this condition early and stops with a plain-English message.
  • importList(): passing an unnamed or partially-named list produced a cryptic "'names' must be a character vector" error from base R. The function now checks for missing names before proceeding and stops with an informative message. Passing an empty list now also produces a message rather than silently doing nothing.

Bug fixes

  • correlate(): when fewer than 2 numeric variables were present in the input, the function could iterate incorrectly due to 1:(n-1) evaluating to c(1, 0) rather than an empty sequence. Fixed with seq_len(n-1).
  • oneSampleTTest(): the conf.level argument was not forwarded to stats::t.test(), so $conf.int always contained the 95% interval regardless of what the user requested (#9).
  • independentSamplesTTest(), pairedSamplesTTest(), associationTest(): passing a tibble as data caused spurious type-check failures. Fixed by coercing data to a plain data frame on entry (#2).

Dependencies

  • tibble and withr added to Suggests (used in tests only).

---

From NEWS.md in the release

Install

Health

CRAN checks
5NOTE8OK
Check messages
NOTER code for possible problemsr-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-x86_64
Found calls to structure() using deprecated special names:
  lsr/tests/testthat/test-independentSamplesTTest.R (.Names: 1)
  lsr/tests/testthat/test-oneSampleTTest.R (.Names: 1)
'.Names' should be changed to 'names'.

CRAN check page ↗

Slowest check: 1.4 min · r-devel-windows-x86_64
Status changes
  • NOTE8 OK, 5 NOTENow
  • NOTE11 OK, 2 NOTE2026-07-16
  • OK13 OK2026-07-15
  • NOTE12 OK, 2 NOTE2026-03-10
Advisories

none known

Documentation

In release 1.0.0
READMEYes · 188 wordsVignettes· In the repository, left out of the releaseNEWSYes · 100% structured · mentions 1.0.0Citation fileNoWebsiteYes · pkgdown

The repository also keeps web-only articles.

Help pages
32
Examples that run
100%27 run in a plain check
Exported functions with examples
100%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
3%

Downloads

119.9K
CRAN downloads in the past year
Rank #1,250 · ~328/day · ~10K/mo
Daily download trend is not available in this view yet.
9.3K30 days
24.7K90 days
119.9K1 year
Compare downloads with other packages →
Also on496 r2u5 autocran2.5K conda_forge

Repository

13Stars
5Forks
1Open issues
0Open PRs
4Releases
112Commits
2Commit identities
112 commits · Last activity 2026-07-11 · +8.3% stars, 30d
Responsiveness
How these are sampled
PRs merged (all time)
100%
Median days to close, 50 most recently updated closed issues
1,747
Median days to close, 50 most recently updated closed PRs
0

Stars over time

2021-12-01 · 122026-10-20 · 13
PracticesBeta

10 development-tooling and community-health practices detected across 5 families in the upstream repository

Checks run against github.com/djnavarro/lsr on 2026-10-21.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-07-19 · The repository has a site deploy workflow

pkgdown site last built 2026-07-19

Coverage (1)
Coverage reporting (Codecov)
CRAN release process (2)
cran-comments.mdCRAN-SUBMISSION
Show all practicesHide 1 practice
Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v4 (2026-10-20)

Dependencies

Declared dependencies
5 external dependencies (excludes base and recommended)

Installing lsr adds no packages beyond those that come with R.

Depends (0)
none
Imports (4)
graphicsgrDevicesmethodsstats
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
5direct
2indirect
Depends 1 · Imports 4
Depends, Imports or LinkingTo, most downloaded first

People & History

People (1)
Author, Maintainer · added in 0.5.1

Maintainer since 0.1 (2011)

Listed in earlier versions (1)
Daniel Navarro
no longer listed · 0.1 to 0.5
Releases (14)

Pick two releases to compare their code metrics.

  • 1.0.0Latest
    record
    2026-07-11 · current release · diff ↗
  • R
    R 4.6.0 released · 2026-04-24
  • R
    R 4.5.0 released · 2025-04-11
  • R
    R 4.4.0 released · 2024-04-24
  • R
    R 4.3.0 released · 2023-04-21
  • R
    R 4.2.0 released · 2022-04-22
  • 0.5.2
    record
    2021-12-01 · diff ↗
  • 0.5.1
    record
    2021-09-20 · diff ↗
  • R
    R 4.1.0 released · 2021-05-18
  • R
    R 4.0.0 released · 2020-04-24
  • R
    R 3.6.0 released · 2019-04-26
  • R
    R 3.5.0 released · 2018-04-23
  • R
    R 3.4.0 released · 2017-04-21
  • R
    R 3.3.0 released · 2016-05-03
  • R
    R 3.2.0 released · 2015-04-16
  • 0.5
    record
    2015-03-02 · diff ↗
Show 14 earlier eventsHide 14 earlier events
  • R
    R 3.1.0 released · 2014-04-10
  • 0.3.2
    record
    2014-01-31 · diff ↗ ·
    added 2 exports
    goodnessOfFitTest, associationTest
  • 0.3.1
    record
    2013-11-19 · diff ↗ ·
    added 3 exports
    oneSampleTTest, pairedSamplesTTest, independentSamplesTTest
  • 0.3
    record
    2013-11-13 · diff ↗ ·
    added 2 exports
    correlate, bars
  • 0.2.4
    record
    2013-06-13 · diff ↗
  • 0.2.3
    record
    2013-04-19 · diff ↗
  • R
    R 3.0.0 released · 2013-04-03
  • 0.2.2
    record
    2013-01-15 · diff ↗
  • 0.2.1
    record
    2012-11-28 · diff ↗ ·
    removed 1 export
    xfun
  • 0.2
    record
    2012-11-14 · diff ↗ ·
    removed 3 exports
    wideToMV, longRM, wideRM
    added 5 exports
    permuteLevels, colCopy, rowCopy, expandFactors, xfun
  • R
    R 2.15.0 released · 2012-03-30
  • 0.1.1
    record
    2012-01-23 · diff ↗
  • 0.1
    record
    2011-12-11
  • R
    R 2.14.0 released · 2011-10-31

Package metadata

First published
2011-12-11
Total releases
14 / 15 yrs
License
MIT + file LICENSE OSI · relicensed from GPL-3 in 0.5.1
Download size
83 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("lsr")
Navarro, D. (2026). lsr: Companion to "Learning Statistics with R" (Version 1.0.0) [Computer software]. https://doi.org/10.32614/CRAN.package.lsr

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for lsr version 1.0.0 [Data set]. HJJB, LLC. Data release v2026-10-23. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-23, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy