split_subset: Equally Divide a Set

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Given the boundaries of a set and the observations it contains, use this function to repartition the set into 2 equal subsets containing the same number of observations.

Usage

1
split_subset(x, limits)

Arguments

x

The observations belonging to the set.

limits

A vector of length 2, giving the boundaries of the subset (1D).

Value

A matrix, where each row gives the limits of the new subsets.

Examples

1
2
3
x <- runif(10,-1,1)
split_subset(x,c(-1,1)) # Returns a matrix of two intervals, which each contain
                        # 5 of the randomly generated points.

dfcorbin/MABsim documentation built on April 26, 2020, 8:26 a.m.