Index: branches/2719_HeuristicLab.DatastreamAnalysis/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs
===================================================================
--- branches/2719_HeuristicLab.DatastreamAnalysis/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs	(revision 15866)
+++ branches/2719_HeuristicLab.DatastreamAnalysis/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs	(revision 17980)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -25,15 +25,15 @@
 using System.Collections.ObjectModel;
 using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Problems.DataAnalysis {
   [Item("Dataset", "Represents a dataset containing data that should be analyzed.")]
-  [StorableClass]
+  [StorableType("49F4D145-50D7-4497-8D8A-D190CD556CC8")]
   public class Dataset : NamedItem, IDataset {
     [StorableConstructor]
-    protected Dataset(bool deserializing) : base(deserializing) { }
+    protected Dataset(StorableConstructorFlag _) : base(_) { }
     protected Dataset(Dataset original, Cloner cloner)
       : base(original, cloner) {
@@ -115,18 +115,44 @@
     }
 
+    public static Dataset FromRowData(IEnumerable<string> variableNames, double[,] data) {
+      var colWise = new List<IList>(data.GetLength(1));
+      for (var col = 0; col < data.GetLength(1); col++) {
+        var column = new List<double>(data.GetLength(0));
+        for (var row = 0; row < data.GetLength(0); row++) {
+          column.Add(data[row, col]);
+        }
+        colWise.Add(column);
+      }
+      return new Dataset(variableNames, colWise);
+    }
+
+    public static Dataset FromRowData(IEnumerable<string> variableNames, IEnumerable<IList> data) {
+      var vnames = variableNames.ToList();
+      var transposed = new List<IList>();
+      var iter = data.GetEnumerator();
+      if (!iter.MoveNext()) throw new ArgumentException("Data does not contain any rows", nameof(data));
+      for (var i = 0; i < iter.Current.Count; i++) {
+        if (i >= vnames.Count) throw new ArgumentException("There are more variables in data, than variable names.", nameof(variableNames));
+        if (iter.Current[i] == null) throw new ArgumentException("Null values are not supported.", nameof(data));
+        if (!IsAllowedType(iter.Current[i].GetType())) throw new ArgumentException("Data contains types that are not allowed.", nameof(data));
+        if (iter.Current[i] is double d)
+          transposed.Add(new List<double>() { d });
+        else if (iter.Current[i] is DateTime dt)
+          transposed.Add(new List<DateTime>() { dt });
+        else if (iter.Current[i] is string s)
+          transposed.Add(new List<string>() { s });
+        else throw new NotSupportedException(string.Format("Variable {0} has type {1}. This is not supported when converting from row-wise data.", vnames[i], iter.Current[i].GetType()));
+      }
+      if (transposed.Count < vnames.Count) throw new ArgumentException("There are less variables in data, than variable names.", nameof(variableNames));
+      while (iter.MoveNext()) {
+        for (var i = 0; i < iter.Current.Count; i++)
+          if (transposed[i].Add(iter.Current[i]) < 0)
+            throw new ArgumentException(string.Format("Variable {0} has invalid value ({1})", vnames[i], iter.Current[i]), nameof(data));
+      }
+      return new Dataset(vnames, transposed);
+    }
+
     public ModifiableDataset ToModifiable() {
-      var values = new List<IList>();
-      foreach (var v in variableNames) {
-        if (VariableHasType<double>(v)) {
-          values.Add(new List<double>((IList<double>)variableValues[v]));
-        } else if (VariableHasType<string>(v)) {
-          values.Add(new List<string>((IList<string>)variableValues[v]));
-        } else if (VariableHasType<DateTime>(v)) {
-          values.Add(new List<DateTime>((IList<DateTime>)variableValues[v]));
-        } else {
-          throw new ArgumentException("Unknown variable type.");
-        }
-      }
-      return new ModifiableDataset(variableNames, values);
+      return new ModifiableDataset(variableNames, variableNames.Select(v => variableValues[v]), true);
     }
 
@@ -141,10 +167,10 @@
     }
 
-    protected Dataset(Dataset dataset) : this(dataset.variableNames, dataset.variableValues.Values) { }
+
 
     #region Backwards compatible code, remove with 3.5
     private double[,] storableData;
-    //name alias used to suppport backwards compatibility
-    [Storable(Name = "data", AllowOneWay = true)]
+    //name alias used to support backwards compatibility
+    [Storable(OldName = "data")]
     private double[,] StorableData { set { storableData = value; } }
 
@@ -179,4 +205,8 @@
       }
     }
+
+    public bool ContainsVariable(string variableName) {
+      return variableValues.ContainsKey(variableName);
+    }
     public IEnumerable<string> DoubleVariables {
       get { return variableValues.Where(p => p.Value is IList<double>).Select(p => p.Key); }
@@ -318,7 +348,8 @@
     #region IStringConvertibleMatrix Members
     [Storable]
-    protected int rows;
+    private int rows;
     public int Rows {
       get { return rows; }
+      protected set { rows = value; }
     }
     int IStringConvertibleMatrix.Rows {
