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
Change the sytanx to make it more apparent that select_by_criteria() is just a wrapper for subset() that works with lazy eval calls and does error handling.
The text was updated successfully, but these errors were encountered:
made the following changes, and checked that results are identical:
# function to subset dataframe by criteria and do error checkingselect_by_criteria<-function(x,criteria){
if(!is.null(criteria)) {
# if criteria are specified, subset the dataframe accordinglyout<- subset(x,eval(criteria))
} else {
# if no criteria are specified, do nothingout<-x
}
# if no results are returned, return an errorif( nrow(out) ==0 ) {
stop( "No matches found. Either: 1. the name of variable(s) you specified is/are incorrect or 2. the values you are looking for are not contained in the variable(s) you specified")
}
return(tbl_df(out))
}
Change the sytanx to make it more apparent that
select_by_criteria()
is just a wrapper forsubset()
that works with lazy eval calls and does error handling.The text was updated successfully, but these errors were encountered: