tests/testthat/test_sample.R

context("sf: st_crs tests")

test_that("st_sample works", {
	nc = read_sf(system.file("shape/nc.shp", package="sf"))
	n = 100
	sample_default = st_sample(x = nc, size = n)
	expect_s3_class(sample_default, "sfc")
	sample_exact = st_sample(x = nc, size = n, exact = TRUE)
	expect_equal(length(sample_exact), n)
})

Try the sf package in your browser

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

sf documentation built on July 24, 2019, 5:05 p.m.