We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
manual_correction()
Current use:
l = with(data, which(subjid==111 & dqlq=="2020/03")) manual_correction(data, dqlq, rows=l, wrong="2020/03", correct="2021/03") wrong = ymd("2011/11/29", "2021/01/12", "2019/12/11", "2020/12/28") l=which(data$tc_dt %in% wrong & data$subjid %in% c(128,196,17,73)) wrong = data$tc_dt[l] manual_correction(data, tc_dt, rows=l, wrong=wrong, correct=rep(NA, 4))
Problem: when the database is corrected, wrong is not of the right length (eventually 0).
wrong
Proposition:
manual_correction(data, tc_dt, predicate=tc_dt %in% wrong & subjid %in% c(128,196,17,73), correct=rep(NA, 4))
With predicate to be evaluated within data.
predicate
data
The text was updated successfully, but these errors were encountered:
f = function(data, predicate, column, wrong, right, multiple=FALSE){ x = data %>% filter(!!enquo(predicate) & {{column}}==wrong) %>% nrow() if(x==0) stop("already corrected") if(x>1 && !multiple) stop("More than 1 row corrected") data %>% mutate( {{column}} := ifelse(!!enquo(predicate) & {{column}}==wrong, right, {{column}}) ) } df = iris %>% f(Species=="virginica" & Sepal.Width==3.6, column=Sepal.Length, wrong=7.2, right=999) df = iris %>% f(Species=="virginica" & Sepal.Width==3.6, column=Sepal.Length, wrong=998, right=999)
Sorry, something went wrong.
No branches or pull requests
Current use:
Problem: when the database is corrected,
wrong
is not of the right length (eventually 0).Proposition:
With
predicate
to be evaluated withindata
.The text was updated successfully, but these errors were encountered: