We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider:
DT <- data.table(a = 0L:1L, b = c(1L, 1L)) DT[ , lapply(.SD, function(x) if (all(x)) x)]
Which gives error:
Error in setnames(jval, jvnames) : Can't assign 2 names to a 1 column data.table
setnames(jval, jvnames)
data.table
That is, j evaluates to a single column (b) but jvnames still contains both columns a and b.
j
b
jvnames
a
Does this happen for a particular reason? The above seems like the most natural way to subset columns to me.
My current workaround looks atrocious:
DT[ , mget(names(.SD)[sapply(.SD, function(x) all(x == 1))])]
The text was updated successfully, but these errors were encountered:
c7a0831
Fix for the issue introduced while fixing #1477.
b901d1a
arunsrinivasan
No branches or pull requests
Consider:
Which gives error:
That is,
j
evaluates to a single column (b
) butjvnames
still contains both columnsa
andb
.Does this happen for a particular reason? The above seems like the most natural way to subset columns to me.
My current workaround looks atrocious:
The text was updated successfully, but these errors were encountered: