FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

get() in by and the inconsistent error · Issue #4873 · Rdatatable/data.table · GitHub

get() in by and the inconsistent error #4873

Description

IDT <- data.table(iris)
vr <- "Species"
IDT[, virginca := get(vr) == "virginica"]
IDT[(virginca)][, .N, by = .(round(Sepal.Width), k = round(Sepal.Length), kar = get(vr))] 
# Works fine

IDT[(virginca), .N, by = .(round(Sepal.Width), k = round(Sepal.Length), kar = get(vr))] 
# Error in get(vr) : object 'Species' not found

This is the closest I could get to reproducing the error I got on data in the wild when I added a logical in i, but my actual error message was

column or expression 3 of 'by' or 'keyby' is type builtin. Do not quote column names. Usage: DT[,sum(colC),by=list(colA,month(colB))]

I'm using R 4.0.2 and data.table_1.13.4 on Windows 10.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    programmingparameterizing queries: get, mget, eval, env

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL