mooreryan / featuretable

MIT License
1 stars 1 forks source link

Error: feature_table should be 2 dimensional after subsetting data #7

Open mooreryan opened 1 year ago

mooreryan commented 1 year ago
ct <- data.frame(s1 = c(1,1,1), s2 = c(100, 0, 100), row.names = letters[1:3])
FeatureTable$new(t(ct))$keep_samples(function(x) sum(x) > 10)$keep_features(function(x) x > 0)

Error in `initialize()`:
! feature_table should be 2 dimensional!
Run `rlang::last_error()` to see where the error occurred.

Note that up to the last keep_features works

FeatureTable$new(t(ct))$keep_samples(function(x) sum(x) > 10)
FeatureTable: 
  data         -- 1 samples, 3 features

Interesting behavior as:

FeatureTable$new(t(ct))$keep_samples(function(x) sum(x) > 10)$dim() %>% length

is 2, and the check that fails goes something like this: if (length(dim(feature_table)) != 2) { ...fail...