gen.structure: Generate a structure

Description Usage Arguments Details Examples

View source: R/gen.R

Description

If you can create an object with structure, you should be able to generate an object with this function from a generator or list of generators.

Usage

1

Arguments

x

an object generator which will have various attributes attached to it.

...

attributes, specified in 'tag = value' form, which will be attached to generated data.

Details

gen.structure accepts the same forms of data as forall, and is flexible, in that any list of generators is considered to be a generator.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# To create a matrix
gen.structure( gen.c(of = 6, gen.element(1:30)), dim = 3:2)

# To create a data frame for testing.
gen.structure (
  list ( gen.c(of = 4, gen.element(2:10))
       , gen.c(of = 4, gen.element(2:10))
       , c('a', 'b', 'c', 'd')
       )
  , names = c('a','b', 'constant')
  , class = 'data.frame'
  , row.names = c('1', '2', '3', '4' ))

hedgehog documentation built on May 2, 2019, 11:27 a.m.