-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function to create meta information from scratch #22
Comments
We could do z <- list(
meta = dots_to_underscore(empty_list_to_null(meta)),
data = data,
set_id = gsub(".", "_", set_id, fixed = TRUE)
)
names(z$meta) <- gsub("utc_updated", "updated_utc", names(z$meta), fixed = TRUE)
class(z) <- "swissdata"
if (test) ans <- dataset_validate(z) And then perhaps another function, |
I think that's definitely going into the right direction. I like the idea to create swissdata objects that way and to validate them is perfect – would also make a perfect test. I've been thinking about a potential Consider to six <- fread("https://raw.githubusercontent.com/KOF-ch/economic-monitoring/master/data/ch.six.csv")
#> Error in fread("https://raw.githubusercontent.com/KOF-ch/economic-monitoring/master/data/ch.six.csv"): could not find function "fread"
metadata_six <- list(
"title" = list(en = "SIX Debit and Credit Card Use"),
"source.name"= list(en = "SIX"),
"source.url" = "https://github.com/statistikZH/covid19monitoring_economy_SIX",
dim.order = c("variable"),
hierarchy = list(
variable = list(
"stat_einkauf" = NA,
"bezug_bargeld" = NA,
"stat_einkauf" = NA
)
),
labels = list(
dim.names = list(
variable = list(
en = "variable"
)
),
debiteinsatz_ausland = list(
en = "Volume Debitcard use abroad",
de = " Finanzvolumen Debitkarteneinsatz im Ausland"
),
bezug_bargeld = list(
en = "Volume Cash Withdrawal Switzerland",
de =" Finanzvolumen Bargeldbezug Debitkarten in der Schweiz"
),
stat_einkauf = list(
en = "Volume debit card use in retatil (w/o online)",
de = "Finanzvolumen Debitkarteneinsatz stationärer Einkauf in der Schweiz (kein Online-Handel)"
)
),
details = list(
en = "Die Daten von SIX Payment Services umfassen bargeldlose Transaktionen und Bargeldbezüge im In- und Ausland, für welche von Schweizer Banken ausgehändigte Debitkarten der folgenden Marken verwendet wurden: Debit Mastercard, Maestro CH, V PAY oder Visa Debit."
),
utc.updated = Sys.time()
) Created on 2020-04-11 by the reprex package (v0.3.0) How could we make a function out of this? Maybe we make it multiple step process:
Besides I like the idea to also think about I/O here. How about a |
(I am using Yes, I like your second step: How to edit Which one may depend on the user need an so it is ok to leave that open. |
Practical swissdata experience has shown that defining meta information in strings – no matter whether it is .json or .yaml is not very intuitive. For an R person the natural way to define a hierarchical structure is a list. Also because indent an code highlighting works so well as opposed to json in R Studio.
The text was updated successfully, but these errors were encountered: