Skip to content

Commit

Permalink
special casing for T and F. #217
Browse files Browse the repository at this point in the history
  • Loading branch information
romainfrancois committed Jan 28, 2014
1 parent 141185f commit 96a26ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion NEWS.md
Expand Up @@ -21,7 +21,9 @@ dplyr 0.1.0.99

* `filter` handles scalar results (#217) and better handles scoping, e.g.
`filter(.,variable)` where `variable` is defined in the function that calls
`filter`
`filter`. It also handles `T` and `F` correctly as aliases to `TRUE` and
`FALSE` only if there are no `T` or `F` variables in the data or
in the scope.

* `select.grouped_df` fails when the grouping variables are not included
in the selected variables (#170)
Expand Down
6 changes: 6 additions & 0 deletions src/dplyr.cpp
Expand Up @@ -874,6 +874,12 @@ SEXP assert_correct_filter_subcall(SEXP x, const SymbolSet& set, const Environme
// look in the environment
Shield<SEXP> res( Rf_findVar( x, env ) );
if( res == R_UnboundValue ){
if( x == Rf_install("T") ){
return Rf_ScalarLogical(TRUE) ;
} else if( x == Rf_install("F") ){
return Rf_ScalarLogical(FALSE) ;
}

std::stringstream s ;
s << "unknown column : " << CHAR(PRINTNAME(x)) ;
stop(s.str());
Expand Down

0 comments on commit 96a26ec

Please sign in to comment.