MyNixOS website logo
Description

Companion to the Book "Computational Statistics with R".

Provides data sets and functions used in the book "Computational Statistics with R" (<https://cswr.nrhstat.org>).

CSwR

R buildstatus Codecoverage

The CSwR package is a companion to the book Computational Statistics with R available at cswr.nrhstat.org. It provides data and utility functions used throughout the book for teaching computational statistics concepts.

Installation

You can install the latest version from CRAN with:

install.packages("CSwR")

Or install the development version from GitHub with:

# install.packages("pak")
pak::pak("jolars/CSwR-Package")

Features

The package includes:

  • Datasets: Five datasets used in examples throughout the book:

    • greenland - Monthly temperature data from southwest Greenland (1873-2013)
    • nuuk - Annual temperature summaries for Nuuk (1867-2013)
    • vegetables - Weekly frozen vegetable sales data
    • angle - Torsion angles from protein structure (1HMP)
    • news - Social media news sharing features from Mashable articles
  • Tracer objects (tracer()) - Collect, print, and visualize trace information during function evaluation for debugging and performance analysis

  • Terminator objects (terminator()) - Define termination conditions for iterative algorithms with callback support

  • Random number streams (rng_stream()) - Efficient cached random number generation

  • Force evaluation (force_all()) - Utility to force evaluation of all function arguments and avoid lazy evaluation pitfalls

  • Plotter expressions (plotter()) - Create expressions for iterative plot updates during long-running computations

Usage

library(CSwR)

# Load and explore datasets
data(greenland)
head(greenland)
  Year Month Temp_nuuk Temp_Qaqortoq Temp_diff
1 1873     1     -12.1          -9.9      -2.2
2 1874     1     -13.1         -11.6      -1.5
3 1875     1      -6.6          -6.3      -0.3
4 1876     1     -11.1          -8.3      -2.8
5 1877     1     -14.5          -8.8      -5.7
6 1878     1      -7.7          -6.8      -0.9
# Create a tracer for monitoring algorithm progress
tr <- tracer(c("x", "residual"), time = TRUE)
# Use tr$tracer as a callback in your iterative function

# Set up a terminator with a convergence condition
term <- terminator(cond = quote(residual < 1e-6), Delta = 10)
# Returns TRUE when condition is met

Documentation

For detailed documentation and examples, visit the package website or see the book at cswr.nrhstat.org.

License

MIT License.

Metadata

Version

0.1.3

License

Unknown

Platforms (79)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    wasip1
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasip1
  • wasm64-wasip1
  • x86_64-cygwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows