data_gen: Generate Synthetic Data with Various Structures

View source: R/utils_data.R

data_genR Documentation

Generate Synthetic Data with Various Structures

Description

Generates either:

  • Structured (x, y) scatter data (linear, sine, circle, etc.), or

  • A matrix of scaled orthogonal polynomial features.

Usage

data_gen(type = "all", n = 500, degree = NULL, seed = NULL)

Arguments

type

Character string. Options:

  • "polynomial" for orthogonal polynomial features

  • "linear", "sine", "circle", "cluster", "snake", "outliers", "sparse", "clumpy", "skewed", "striated", "concave", "monotonic", "doughnut", or "all" to generate all scatter structures.

n

Integer. Number of samples to generate. Default is 500.

degree

Integer. Degree of polynomial features (only for type = "polynomial").

seed

Optional integer. Sets random seed for reproducibility.

Value

  • If type = "polynomial", returns a matrix (n x degree).

  • Otherwise a tibble with columns:

  • x: Numeric vector of x-values

  • y: Numeric vector of y-values

  • structure: Character name of the structure type

Examples

data_gen("linear", n = 200)
data_gen("polynomial", degree = 4, n = 200)
data_gen("all", n = 200)


spinebil documentation built on Nov. 5, 2025, 7:35 p.m.