Skip to content

Commit a0c81a7

Browse files
committed
test_fields_match: more bug fixing; remove EML::get_eml command that returned a filename ending in .csv and had an error, "unrecognized file extension"
1 parent b096e06 commit a0c81a7

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

R/tabular_data_congruence.R

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -531,14 +531,19 @@ test_fields_match <- function(directory = here::here(), metadata = load_metadata
531531
metadata_attrs <- lapply(data_tbl, function(tbl) {arcticdatautils::eml_get_simple(tbl, "attributeName")})
532532
metadata_attrs$`@context` <- NULL
533533

534-
table_names <- EML::eml_get(data_tbl, "objectName")
535-
table_names$`@context` <- NULL
534+
#list all data files that are in data package
535+
data_files <- list.files(path = directory, pattern = ".csv")
536+
537+
#get names of each file to add to attributes table
538+
table_names <- NULL
539+
for (i in 1:length(seq_along(data_files))) {
540+
tbl_nam <- data_tbl[[i]][["physical"]][["objectName"]]
541+
table_names <- append(table_names, tbl_nam)
542+
}
543+
#list metadata atttributes by file name
536544
names(metadata_attrs) <- table_names
537-
# for some reason this returns an error? replaced with the above 3 lines:
538-
#names(metadata_attrs) <- arcticdatautils::eml_get_simple(data_tbl, "objectName")
539545

540546
# Get list of column names for each table in the csv data
541-
data_files <- list.files(path = directory, pattern = ".csv")
542547
data_colnames <- sapply(data_files, function(data_file) {names(readr::read_csv(file.path(directory, data_file), n_max = 1, show_col_types = FALSE))}, USE.NAMES = TRUE, simplify = FALSE)
543548

544549
# Quick check that tables match

0 commit comments

Comments
 (0)