I have started working with dplyr library recently and experienced a very strange problem as I explain on the following example:
Data:
df <- data.frame(Number = c(1,2), Letter = c('a','b'))
df = tbl_df(tst)
Problem:
Running a select and filter like this:
df %>% select(Number) %>% filter(Letter == 'a')
gives me the error:
"Error in filter_impl(.data, quo) :
Evaluation error: object 'Letter' not found."
While I can change the order of select and filter and it works OK:
df %>% filter(Letter == 'a') %>% select(Number)
Result:
# A tibble: 1 x 1
Number
<dbl>
1 1
I could not find any place that explains if it is a general rule and there is some order for using dplyr key functions or there is another problem.