Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

makeDataFrame

Initialize data.frame in a convenient way.


Description

Initialize data.frame in a convenient way.

Usage

makeDataFrame(nrow, ncol, col.types, init, row.names = NULL,
  col.names = sprintf("V%i", seq_len(ncol)))

Arguments

nrow

[integer(1)]
Nubmer of rows.

ncol

[integer(1)]
Number of columns.

col.types

[character(ncol) | character(1)]
Data types of columns. If you only pass one type, it will be replicated. Supported are all atomic modes also supported by vector, i.e. all common data frame types except factors.

init

[any]
Scalar object to initialize all elements of the data.frame. You do not need to specify col.types if you pass this.

row.names

[character | integer | NULL]
Row names. Default is NULL.

col.names

[character | integer]
Column names. Default is “V1”, “V2”, and so on.

Examples

print(makeDataFrame(3, 2, init = 7))
print(makeDataFrame(3, 2, "logical"))
print(makeDataFrame(3, 2, c("logical", "numeric")))

BBmisc

Miscellaneous Helper Functions for B. Bischl

v1.11
BSD_2_clause + file LICENSE
Authors
Bernd Bischl [aut, cre], Michel Lang [aut], Jakob Bossek [aut], Daniel Horn [aut], Jakob Richter [aut], Dirk Surmann [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.