Skip to content

Commit

Permalink
adding a debugging scripts folder
Browse files Browse the repository at this point in the history
  • Loading branch information
collinschwantes committed Dec 9, 2024
1 parent a052e78 commit 94a3600
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions scripts/debug_expand_df.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
devtools::load_all()


# read in data



df <- read.csv("vignettes/data_examples/my_data.csv")

# create codebook

structural_metadata <- create_structural_metadata(df,primary_key = "key",
foreign_key = c("measured_by","site_name"))

# create data package


dp <- frictionless::create_package() |>
frictionless::add_resource(resource_name = "my_data",
data = df)

frictionless::write_package(package = dp,
directory = "vignettes/data_examples")

expand_frictionless_metadata(structural_metadata = structural_metadata,
resource_name = "my_data",
resource_path = "vignettes/data_examples/my_data.csv",
data_package_path = "vignettes/data_examples/datapackage.json"
)

## drop a measured_by column

df <- read.csv("vignettes/data_examples/my_data.csv")

# create codebook

structural_metadata_2 <- create_structural_metadata(df,
primary_key = "key",
foreign_key = c("site_name"))


expand_frictionless_metadata(structural_metadata = structural_metadata_2,
resource_name = "my_data",
resource_path = "vignettes/data_examples/my_data.csv",
data_package_path = "vignettes/data_examples/datapackage.json"
)

0 comments on commit 94a3600

Please sign in to comment.