vpart: Data partitioning utility

View source: R/MPMutils.R

vpartR Documentation

Data partitioning utility

Description

Extract a random partition from an input dataset.

Usage

vpart(data, p, shuffle = FALSE, ...)

Arguments

data

An input data.frame.

p

Proportion of rows to be extracted from the input dataset.

shuffle

A logical value. If TRUE, the input rows are randomly shuffled before data partitioning.

...

Currently ignored.

Value

A list of 2 data.frames:

  1. "training.set", the portion of the input data defined by p;

  2. "validation.set", the portion of the input data defined by 1-p.

Author(s)

Fernando Palluzzi fernando.palluzzi@gmail.com

See Also

buildPredictor,

Examples


# Extract a subset of 300 subjects and an outcome vector of length 30 
# from the default simulated dataset

x <- mosaic::sample(mpm.us, 300, replace = FALSE, prob = NULL)

# Data partitioning

x <- vpart(x, p = 0.75)
print(dim(x$training.set))
print(dim(x$validation.set))


Morphonodepredictivemodel/morphonode documentation built on Feb. 15, 2023, 4:51 a.m.