Skip to content

colMeans2 does row wise calculation with newer R versions #247

Open
@itsme24

Description

@itsme24

Dear all,
I get a weird behaviour with R version 4.3.1 which does not calculate the colMeans2 any more but does a row-wise calculation. This is not the case with e.g. R 4.2.2.

I couldn't figure out if and where the feature in the c-code this is coming from.
I haven't found another colFunc where I found this row-wise result.

print(R.version.string)

a<- data.table(rebalancing=rep(c(1L,NA), 5) , coverage=rep(c(1.0,0.5,0.9,0.5,0.8),2), b='b')

print('base')
print(a[, colMeans(cbind(coverage*rebalancing), na.rm=T) , by='b'] )

print('matrixStats')
a[, matrixStats::colMeans2(cbind(coverage*rebalancing), na.rm=T) , by='b']

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions