Allocates a data frame with given column classes.

# S3 method for default
dataFrame(colClasses, nrow=1, ...)

Arguments

colClasses

A character vector of column classes, cf. read.table.

nrow

An integer specifying the number of rows of the allocated data frame.

...

Not used.

Value

Returns an NxK data.frame where N equals nrow and K equals length(colClasses).

See also

Examples

  df <- dataFrame(colClasses=c(a="integer", b="double"), nrow=10)
  df[,1] <- sample(1:nrow(df))
  df[,2] <- rnorm(nrow(df))
  print(df)
#>     a           b
#> 1   2 -0.24957671
#> 2   7  1.22967364
#> 3   8  1.48943793
#> 4   4  2.06215691
#> 5   3 -0.95787619
#> 6   6 -0.43193433
#> 7  10  1.06433056
#> 8   9  0.06386913
#> 9   5  0.40062933
#> 10  1 -0.85617704