private void PreserveColumns(IEnumerable <Transformation <double> > transformations)
 {
     foreach (var transformation in transformations)
     {
         if (!originalColumns.ContainsKey(transformation.Column))
         {
             int colIndex     = preprocessingData.GetColumnIndex(transformation.Column);
             var originalData = preprocessingData.GetValues <double>(colIndex);
             originalColumns.Add(transformation.Column, originalData);
         }
     }
 }
        public void SetFilter(bool[] remainingRows)
        {
            filteredData = (IPreprocessingData)originalData.Clone();
            filteredData.InTransaction(() => {
                var remainingIndices = Enumerable.Range(0, remainingRows.Length).Where(x => remainingRows[x]);

                foreach (var v in filteredData.VariableNames)
                {
                    var ci = filteredData.GetColumnIndex(v);
                    if (filteredData.VariableHasType <double>(ci))
                    {
                        var values         = filteredData.GetValues <double>(ci);
                        var filteredValues = remainingIndices.Select(x => values[x]).ToList();
                        filteredData.SetValues(ci, filteredValues);
                    }
                    else if (filteredData.VariableHasType <DateTime>(ci))
                    {
                        var values         = filteredData.GetValues <DateTime>(ci);
                        var filteredValues = remainingIndices.Select(x => values[x]).ToList();
                        filteredData.SetValues(ci, filteredValues);
                    }
                    else if (filteredData.VariableHasType <string>(ci))
                    {
                        var values         = filteredData.GetValues <string>(ci);
                        var filteredValues = remainingIndices.Select(x => values[x]).ToList();
                        filteredData.SetValues(ci, filteredValues);
                    }
                }
            });
            OnFilterChanged();
        }