private IDataset CreateDataset(IDataset data, double[,] pcs) { var n = ComponentNames; var nDouble = data.DoubleVariables.Where(x => !VariableNames.Contains(x)).ToArray(); var nDateTime = data.DateTimeVariables.ToArray(); var nString = data.StringVariables.ToArray(); IEnumerable <IList> nData = n.Select((_, x) => Enumerable.Range(0, pcs.GetLength(0)).Select(r => pcs[r, x]).ToList()); IEnumerable <IList> nDoubleData = nDouble.Select(x => data.GetDoubleValues(x).ToList()); IEnumerable <IList> nDateTimeData = nDateTime.Select(x => data.GetDateTimeValues(x).ToList()); IEnumerable <IList> nStringData = nString.Select(x => data.GetStringValues(x).ToList()); return(new Dataset(n.Concat(nDouble).Concat(nDateTime).Concat(nString), nData.Concat(nDoubleData).Concat(nDateTimeData).Concat(nStringData).ToArray())); }
/// <summary> /// Returns true if this table source contains the variable reference. /// </summary> /// <param name="v"></param> /// <returns></returns> public bool ContainsVariable(ObjectName v) { return(VariableNames.Contains(v)); }