Weighted Random Sampling without Replacement

A collection of implementations of classical and novel algorithms for weighted sampling without replacement.


wrswoR

Lifecycle:stable R buildstatus Codecov testcoverage CRANstatus

The goal of wrswoR is to provide faster implementations of weighted random sampling without replacement in R.

Installation

You can install the released version of wrswoR from CRAN with:

install.packages("wrswoR")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("krlmlr/wrswoR")

Example

The functions in this package are a drop-in replacement to sample.int(n, size, replace = FALSE, prob = prob). With large n, sample.int() becomes too slow to be practical, unlike the functions in this package.

library(wrswoR)
set.seed(20200726)

sample_int_crank(20, 10, 1:20)
#>  [1]  8 18 14 17 11 15 10  4 13  5

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("wrswoR")

1.2.1 by Kirill Müller, 5 months ago


https://krlmlr.github.io/wrswoR/


Report a bug at https://github.com/krlmlr/wrswoR/issues


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


Authors: Kirill Müller [aut, cre] (ORCID:


Documentation:   PDF Manual  


GPL-3 license


Imports Rcpp

Suggests BatchExperiments, BiocManager, dplyr, ggplot2, import, kimisc, knitcitations, knitr, metap, microbenchmark, otel, rmarkdown, roxygen2, rticles, sampling, testthat, tidyr, tikzDevice

Linking to Rcpp


Imported by mlfit, rakeR, simPop.

Suggested by Signac, mvgam, singleCellHaystack.


See at CRAN