summaryrefslogtreecommitdiff
path: root/lib/dataset.rb
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2014-10-06 21:44:59 +0200
committermguetlein <martin.guetlein@gmail.com>2014-10-06 21:44:59 +0200
commita10fabfc533b4f21eff0fc102ced5b1d2c3e3699 (patch)
treedb13137316c97b04ddba5319c7888eb83c9f2d92 /lib/dataset.rb
parentd465c7792c2eb563c3e3403cb887f672c394b1e5 (diff)
fix split method for datasets with missing values
Diffstat (limited to 'lib/dataset.rb')
-rw-r--r--lib/dataset.rb6
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