diff options
author | mguetlein <martin.guetlein@gmail.com> | 2014-10-06 21:44:59 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2014-10-06 21:44:59 +0200 |
commit | a10fabfc533b4f21eff0fc102ced5b1d2c3e3699 (patch) | |
tree | db13137316c97b04ddba5319c7888eb83c9f2d92 /lib | |
parent | d465c7792c2eb563c3e3403cb887f672c394b1e5 (diff) |
fix split method for datasets with missing values
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dataset.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/dataset.rb b/lib/dataset.rb index 292b26b..83ef12b 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -308,7 +308,11 @@ module OpenTox dataset.metadata = metadata dataset.features = (feats ? feats : self.features) compound_indices.each do |c_idx| - dataset << [ self.compounds[c_idx] ] + dataset.features.each_with_index.collect{|f,f_idx| self.data_entries[c_idx][f_idx]} + d = [ self.compounds[c_idx] ] + dataset.features.each_with_index.each do |f,f_idx| + d << (self.data_entries[c_idx] ? self.data_entries[c_idx][f_idx] : nil) + end + dataset << d end dataset.put dataset |