loading...

Build, coerce and test for 'data.trame' objects

data.trame(
  ...,
  .key = NULL,
  .rows = NULL,
  .name_repair = c("check_unique", "unique", "universal", "minimal")
)

as.data.trame(
  x,
  .key = NULL,
  .rows = NULL,
  .rownames = NA,
  .name_repair = c("check_unique", "unique", "universal", "minimal"),
  ...
)

# Default S3 method
as.data.trame(
  x,
  .key = NULL,
  .rows = NULL,
  .rownames = NA,
  .name_repair = c("check_unique", "unique", "universal", "minimal"),
  ...
)

# S3 method for class 'list'
as.data.trame(
  x,
  .key = NULL,
  .rows = NULL,
  .rownames = NA,
  .name_repair = c("check_unique", "unique", "universal", "minimal"),
  ...
)

# S3 method for class 'data.frame'
as.data.trame(
  x,
  .key = NULL,
  .rows = NULL,
  .rownames = NA,
  .name_repair = c("check_unique", "unique", "universal", "minimal"),
  ...
)

# S3 method for class 'data.trame'
as.data.trame(
  x,
  .key = NULL,
  .rows = NULL,
  .rownames = NA,
  .name_repair = c("check_unique", "unique", "universal", "minimal"),
  ...
)

# S3 method for class 'data.table'
as.data.trame(
  x,
  .key = NULL,
  .rows = NULL,
  .rownames = NA,
  .name_repair = c("check_unique", "unique", "universal", "minimal"),
  ...
)

# S3 method for class 'data.trame'
as.data.table(x, keep.rownames = FALSE, ...)

is.data.trame(x)

Arguments

...

A set of name-value pairs that constitute the 'data.trame'.

.key

A character vector with the name of the columns to use as key (sorting the data)

.rows

The number of rows in the final 'data.trame'. Useful to create a 0-column object, or for additional check.

.name_repair

Treatment of problematic column names: could be "check_unique" (default, no name repair but check they are unique), "unique" (make sure names are unique), "universal" (make sure names are unique and syntactically correct), "minimal" (no check or name repair except for existence), or a function for custom name repair, e.g., .name.repair = make.names for base R style.

x

An object.

.rownames

The name of the column that holds the row names of the original object, if any. If NA (default), row names are left intact. If NULL row names are removed.

keep.rownames

For compatibility with the generic, but not used here

Value

A 'data.trame' object, which is indeed a 'data.trame'/'data.frame' object, thus subclassing 'data.frame'. is.data.trame() returns TRUE if the object is a 'data.trame', and FALSE otherwise.

Examples

dtrm <- data.trame(
  a = 1:3,
  b = letters[1:3],
  c = factor(LETTERS[1:3]), .key = c('a', 'b'), .rows = 3
)
is.data.trame(dtrm)
#> [1] TRUE