create_schema: Create a Table Schema for a data frame

View source: R/create_schema.R

create_schemaR Documentation

Create a Table Schema for a data frame

Description

Creates a Table Schema for a data frame, listing all column names and types as field names and (converted) types.

Usage

create_schema(data)

Arguments

data

A data frame.

Details

See vignette("table-schema") to learn how this function implements the Data Package standard.

Value

List describing a Table Schema.

See Also

Other create functions: create_package()

Examples

# Create a data frame
df <- data.frame(
  id = c(as.integer(1), as.integer(2)),
  timestamp = c(
    as.POSIXct("2020-03-01 12:00:00", tz = "EET"),
    as.POSIXct("2020-03-01 18:45:00", tz = "EET")
  ),
  life_stage = factor(c("adult", "adult"), levels = c("adult", "juvenile"))
)

# Create a Table Schema from the data frame
schema <- create_schema(df)
str(schema)

frictionlessdata/frictionless-r documentation built on April 17, 2025, 11:45 a.m.