-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
data_filter
: Add support for loop indices within functions?
#309
Comments
data_filter
: Add support for loop indices within functions?
Yeah, I'm not sure if in this particular case: |
The problem is that Currently, if the evaluation fails in @strengejacke what do you think? |
I tried to debug this issue. I saw that in code line: Line 209 in 9b2e2b5
When it comes to subsetting: Lines 228 to 233 in 9b2e2b5
library(datawizard)
df1 <- data.frame(
id = c(1, 2, 3, 1, 3),
item1 = c(NA, 1, 1, 2, 3),
item2 = c(NA, 1, 1, 2, 3),
item3 = c(NA, 1, 1, 2, 3)
)
# Attempt 1
fun <- function(data, id) {
min.index <- NULL
for (i in unique(data[[id]])) {
min.index <- 2
x <- data_filter(data, item3 == min.index)
}
x
}
fun(df1, id = "id")
#> Error: Variable "min.index" was not found in the dataset.
#> Possibly misspelled? Created on 2023-06-16 with reprex v2.0.2 Not sure how/if we can solve this? |
Still within #301, I wonder if it would make sense to add support for loop indices within functions for
data_filter
, @etiennebacher?Created on 2022-11-05 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: