Skip to content

Commit

Permalink
fix set_rcrds for existing data
Browse files Browse the repository at this point in the history
  • Loading branch information
emitanaka committed Oct 11, 2023
1 parent 5451497 commit b75e95e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/rcrds.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ set_rcrds <- function(.edibble, ...,
}

if(is_edibble_table(.edibble)) {
rcrds <- prov$serve_rcrds(return = "value")
for(arcrd in names(rcrds)) {
if(arcrd %in% names(.edibble)) {
#rcrds <- prov$serve_rcrds(return = "value")
for(arcrd in rcrds) {
if(!arcrd %in% names(.edibble)) {
uid <- prov$mapping_to_unit(id = prov$fct_id(name = arcrd))
uname <- prov$fct_names(id = uid)
uids <- prov$fct_id(name = .edibble[[uname]])
uids <- prov$lvl_id(value = .edibble[[uname]], fid = uid)
.edibble[[arcrd]] <- new_edibble_rcrd(rep(NA_real_, nrow(.edibble)), uids)
} else {
.edibble[[arcrd]] <- rcrds[[arcrd]]
.edibble[[arcrd]] <- new_edibble_rcrd(.edibble[[arcrd]])
}
}
}
Expand Down

0 comments on commit b75e95e

Please sign in to comment.