Skip to content
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

Unnecessary warning from gmean about sum greater than integer can hold #986

Closed
mattdowle opened this issue Dec 16, 2014 · 3 comments · Fixed by #3796
Closed

Unnecessary warning from gmean about sum greater than integer can hold #986

mattdowle opened this issue Dec 16, 2014 · 3 comments · Fixed by #3796
Assignees
Milestone

Comments

@mattdowle
Copy link
Member

See at 3:01 into this video :
https://www.youtube.com/watch?v=AmE4LXPQErM

@jangorecki
Copy link
Member

jangorecki commented Aug 1, 2019

data.table(a=c(1L,1L), v=c(2e9L, 2e9L))[, mean(v), a]
#       a    V1
#   <int> <num>
#1:     1 2e+09
#Warning message:
#In gmean(v) :
#  The sum of an integer column for a group was more than type 'integer' can hold so the result has #been coerced to 'numeric' automatically for convenience.

@mattdowle is it fine to add extra argument to gsum called silent or ignore_overflow?

@HughParsonage
Copy link
Member

Or just suppress the warning altogether? The average of an integer vector isn't an integer anyway, so avoiding coercion is not a concern.

@MichaelChirico
Copy link
Member

@jangorecki yea it seems like this is the most expedient way in the current API. Problem is that is a registered routine from R so it needs a bit more effort.

What would be easier is if we have access to a suppressWarnings function from the C level, and we could just wrap gmean's gsum call here:

ans = PROTECT(suppressWarnings(gsum(x,narm))); protecti++;

I don't think that's possible though? So a new argument is the way to go...

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

Successfully merging a pull request may close this issue.

4 participants