This is my first attempted reprex. I am working through R for Data Science. I am trying to narrow down a data frame to then be able to mutate it, but having trouble with the endsWith()
function I think. When I run this section of the code I get the following error message. You can see that when I then change to (x, "delay") I get a different message. I am not sure how to deal with either and would love some help. Also, I'm not sure why, but dplyr::select()
is working for me (as an example), while select() is not, so that's why it's different than the book. Thanks!
flights_sml <- dplyr::select(flights,
year:day,
endsWith("delay"),
distance,
air_time
)
Error: argument "suffix" is missing, with no default Run
rlang::last_error()
to see where the error occurred.
flights_sml <- dplyr::select(flights,
year:day,
endsWith(x, "delay"),
distance,
air_time
)
Error: Must subset columns with a valid subscript vector. x Subscript has the wrong type
logical
. ℹ It must be numeric or character.