You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
library("dplyr")
# Suppose some analysis options are set much earlier in the scriptanalysis_opts<-list(min_outcome=.25)
# Generate some dummy datad<- expand.grid(Subject=1:3, TrialNo=1:2, Time=1:3) %>% tbl_df %>%
arrange(Subject, TrialNo, Time) %>%
mutate(Outcome= (1:18%% c(5, 7, 11)) /10)
# Do some aggregationtrial_outcomes<-d %>% group_by(Subject, TrialNo) %>%
summarise(MeanOutcome= mean(Outcome))
trial_outcomes
Now try to filter the aggregated data using that list of analysis options.
# Works when some_list$x comes secondbad_trials<-trial_outcomes %>% filter(MeanOutcome<analysis_opts$min_outcome)
# Errors when some_list$x comes firstbad_trials<-trial_outcomes %>% filter(analysis_opts$min_outcome>MeanOutcome)
# But no errors when using bracketsbad_trials<-trial_outcomes %>% filter(analysis_opts["min_outcome"] >MeanOutcome)
bad_trials<-trial_outcomes %>% filter(analysis_opts[["min_outcome"]] >MeanOutcome)
# But no errors after ungroupingbad_trials<-trial_outcomes %>% ungroup %>%
filter(analysis_opts$min_outcome>MeanOutcome)
sessionInfo()
## R version 3.1.1 (2014-07-10)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
##
## locale:
## [1] LC_COLLATE=English_United States.1252
## [2] LC_CTYPE=English_United States.1252
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.1252
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] knitr_1.6 dplyr_0.2.0.99
##
## loaded via a namespace (and not attached):
## [1] assertthat_0.1 evaluate_0.5.5 formatR_0.10 magrittr_1.0.1
## [5] parallel_3.1.1 Rcpp_0.11.2 stringr_0.6.2 tools_3.1.1
The exact error message is:
Error in filter_impl(.data, dots(...), environment()) :
object 'MeanOutcome' not found
The text was updated successfully, but these errors were encountered:
Ok so the problem was that when analysing this call analysis_opts$min_outcome > MeanOutcome, we were replacing analysis_opts$min_outcome correctly but then stopped there, instead of dealing with the rest of the expression.
So definitely a case of me not doing the right thing.
lockbot
locked as resolved and limited conversation to collaborators
Jun 10, 2018
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Here's a minimal example of the error.
Now try to
filter
the aggregated data using thatlist
of analysis options.The exact error message is:
The text was updated successfully, but these errors were encountered: