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
I am trying to apply the case_when() function to a tibble object from a database. But when I combine the case_when() function to the mutate() function, I get an error:
dir.create("tmp")
# The datasets.sqlite is just a sqlite database # It contains a table called iris with the iris data frame in it
file.copy("data/datasets.sqlite", "tmp")
# Connect to the databasecon<-DBI::dbConnect(RSQLite::SQLite(), "tmp/datasets.sqlite")
cake<-dplyr::mutate(dplyr::tbl(con, "iris"),
type=dplyr::case_when(
Sepal.Length>5.8|Petal.Length>3.7~"long",
Sepal.Width>3|Petal.Width>1.2~"wide",
TRUE~"other"
)
)
This gives me the following error: Error in eval_bare(f[[2]], env) : object 'Sepal.Length' not found
I think this is to do with the fact that I use mutate() because I do not get an error with the following:
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/
lockbot
locked and limited conversation to collaborators
Jan 29, 2019
This issue was closed.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am working with R 3.4.3 and dplyr 0.7.4.
I am trying to apply the
case_when()
function to a tibble object from a database. But when I combine thecase_when()
function to themutate()
function, I get an error:This gives me the following error:
Error in eval_bare(f[[2]], env) : object 'Sepal.Length' not found
I think this is to do with the fact that I use
mutate()
because I do not get an error with the following:It also is to do with tibbles output (and not with data.frames), because this works fine too:
The text was updated successfully, but these errors were encountered: