rformassspectrometry / QFeatures

Quantitative features for mass spectrometry data
https://RforMassSpectrometry.github.io/QFeatures/
25 stars 7 forks source link

Aggregation by a atomic vector (not a list) #203

Closed lgatto closed 8 months ago

lgatto commented 8 months ago

In this line, we check if groupBy is a atomic vector, but a list is also a vector.

> is.vector(1:5)
[1] TRUE
> is.vector(list())
[1] TRUE

We need to specify a mode:

> is.vector(1:5, "numeric")
[1] TRUE
> is.vector(list(), "list")
[1] TRUE
> is.vector(1:5, "list")
[1] FALSE

Here, we should check with

rlang::is_atomic(groupBy)
## or
is.vector(groupBy) & !is.list(groupBy)