New issue

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

[R-Forge #1757] Add drop to [.data.table, and "dontmove" to not put group columns first #648

Open
arunsrinivasan opened this Issue Jun 8, 2014 · 5 comments

Comments

Projects
None yet
5 participants
@arunsrinivasan
Member

arunsrinivasan commented Jun 8, 2014

Submitted by: Matt Dowle; Assigned to: Nobody; R-Forge link

http://r.789695.n4.nabble.com/Syntax-ag-M-age-age-tp4313006p4313006.html

It wouldn't just build the table and extract the vector at the end, but only construct the vector in the first place; i.e., dogroup.c would need to switch on drop and not populate iby when drop=TRUE.

@mattdowle

This comment has been minimized.

Show comment
Hide comment
@jangorecki

This comment has been minimized.

Show comment
Hide comment
@jangorecki

jangorecki Apr 21, 2016

Member

+1 for support of drop=FALSE to return data.table and not reduce to vector

library(data.table)
x = data.table(a=c(2,5))
x[, sum(a), drop=FALSE]
# could translate to
x[, .(sum(a))]

This is minor thing but increase consistency as type returned won't be dependent on the existence of by, which at least as an option (drop=FALSE) would be nice.
I would use it in another FR, will workaround for now.

Member

jangorecki commented Apr 21, 2016

+1 for support of drop=FALSE to return data.table and not reduce to vector

library(data.table)
x = data.table(a=c(2,5))
x[, sum(a), drop=FALSE]
# could translate to
x[, .(sum(a))]

This is minor thing but increase consistency as type returned won't be dependent on the existence of by, which at least as an option (drop=FALSE) would be nice.
I would use it in another FR, will workaround for now.

@eantonya

This comment has been minimized.

Show comment
Hide comment
@eantonya

eantonya Apr 22, 2016

Contributor

@jangorecki I don't understand why in the given example drop=FALSE would be preferred to .()? Can you explain or maybe you have a better example in mind?

Contributor

eantonya commented Apr 22, 2016

@jangorecki I don't understand why in the given example drop=FALSE would be preferred to .()? Can you explain or maybe you have a better example in mind?

@jangorecki

This comment has been minimized.

Show comment
Hide comment
@jangorecki

jangorecki Apr 22, 2016

Member

@eantonya When I'm just passing j argument from higher function to data.table, it may be arbitrary expression - so no much control over adding .(). I need to have data.table as a result so rbindlist will work. Example here https://github.com/Rdatatable/data.table/pull/1667/files#diff-3b7395e08ce77c2fc6f3923f6790b45eR79 (2016-09-30 link updated)

Member

jangorecki commented Apr 22, 2016

@eantonya When I'm just passing j argument from higher function to data.table, it may be arbitrary expression - so no much control over adding .(). I need to have data.table as a result so rbindlist will work. Example here https://github.com/Rdatatable/data.table/pull/1667/files#diff-3b7395e08ce77c2fc6f3923f6790b45eR79 (2016-09-30 link updated)

@MichaelChirico

This comment has been minimized.

Show comment
Hide comment
@MichaelChirico

MichaelChirico Apr 22, 2016

Contributor

See also #1188

Contributor

MichaelChirico commented Apr 22, 2016

See also #1188

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