tests/testthat/test_tabular.R

library(varitas);

context("Median from tabular data")

test_that(
	"Median of constant vector is constant value", {
		expect_equal(
			tabular.median(
				values = rep(5, 10),
				frequencies = rep(1, 10)
				),
				5
			);
			
		expect_equal(
			tabular.median(
				values = rep(20, 100),
				frequencies = rep(1, 100)
				),
			20
			);
			
		expect_equal(
			tabular.median(
				values = 1,
				frequencies = 10
				),
			1
			);
				
		});
	

Try the varitas package in your browser

Any scripts or data that you put into this service are public.

varitas documentation built on Nov. 14, 2020, 1:07 a.m.