Learn R Programming

weird

Overview

The weird package contains functions and data used in the book That’s Weird: Anomaly Detection Using R by Rob J Hyndman. It also loads several packages needed to do the analysis described in the book.

Installation

You can install the stable version from CRAN with:

install.packages("weird")

You can install the development version of weird from GitHub with:

# install.packages("pak")
pak::pak("robjhyndman/weird")

Usage

library(weird) will also load the following packages:

When you load the weird package, you get a condensed summary of conflicts with other packages you have previously loaded:

library(weird)
#> ── Attaching core weird packages ─────────────────────────── weird 3.0.0 ──
#> ✔ distributional 0.8.1     ✔ ggplot2        4.0.3
#> ✔ dplyr          1.2.1
#> ── Conflicts ─────────────────────────────────────────── weird_conflicts ──
#> ✖ dplyr::filter() masks stats::filter()
#> ✖ dplyr::lag()    masks stats::lag()

Copy Link

Version

Install

install.packages('weird')

Monthly Downloads

367

Version

3.1.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Rob Hyndman

Last Published

September 7th, 2026

Functions in weird (3.1.0)

mvscale

Compute robust multivariate scaled data
oldfaithful

Old faithful eruption data
reexports

Objects exported from other packages
peirce_anomalies

Anomalies according to Peirce's and Chauvenet's criteria
outlier_map

Outlier map from a projection or principal component analysis
surprisals.numeric

Surprisals and surprisal probabilities computed from data
stray_scores

Stray scores
surprisals

Surprisals and surprisal probabilities
stray_anomalies

Stray anomalies
n01

Multivariate standard normal data
surprisals.lm

Surprisals and surprisal probabilities computed from a model
weird-package

weird: Functions and Data Sets for "That's Weird: Anomaly Detection Using R" by Rob J Hyndman
fetch_air_quality

Air quality data for 12 Beijing monitoring stations from 2013 to 2017
density_df

Convert distributional object to a data frame
dist_mclust

Convert Gaussian mixture model to a distributional object
biplot_projection

Biplot of a two-dimensional projection
augment.Pca

Augment data with results from a robust principal component analysis
fetch_wine_reviews

Wine prices and points
gg_bagplot

Bagplot
cricket_batting

Cricket batting data for international test players
dist_kde

Create distributional object based on a kernel density estimate
hdr_regions

Highest density regions for each observation
gg_hdrboxplot

HDR plot
gg_density

Produce ggplot of densities from distributional objects in 1 or 2 dimensions
grubbs_anomalies

Statistical tests for anomalies using Grubbs' test and Dixon's test
glosh_scores

GLOSH scores
kde_bandwidth

Robust bandwidth estimation for kernel density estimation
hampel_anomalies

Identify anomalies using the Hampel filter
hdr_table

Table of Highest Density Regions
lof_scores

Local outlier factors
fr_mortality

French mortality rates by age and sex
gun_deaths

Gun ownership and homicide rates by country