# Load the example Data Package
package <- example_package()
# List the resources
resources(package)
# Create a data frame
df <- data.frame(
multimedia_id = c(
"aed5fa71-3ed4-4284-a6ba-3550d1a4de8d",
"da81a501-8236-4cbd-aa95-4bc4b10a05df"
),
x = c(718, 748),
y = c(860, 900)
)
# Add the resource "positions" from the data frame
package <- add_resource(package, "positions", data = df)
# Add the resource "positions_with_schema", with a user-defined schema and title
my_schema <- create_schema(df)
package <- add_resource(
package,
resource_name = "positions_with_schema",
data = df,
schema = my_schema,
title = "Positions with schema"
)
# Replace the resource "observations" with a file-based resource (2 TSV files)
path_1 <- system.file("extdata", "observations_1.tsv", package = "frictionless")
path_2 <- system.file("extdata", "observations_2.tsv", package = "frictionless")
package <- add_resource(
package,
resource_name = "observations",
data = c(path_1, path_2),
replace = TRUE,
delim = "\t"
)
# List the resources ("positions" and "positions_with_schema" added)
resources(package)
Run the code above in your browser using DataLab