public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); //Get the response and treatment columns foreach (string columnName in dtNew.GetVariableNames()) { if (PValues != columnName && DatasetLabels != columnName) { dtNew.Columns.Remove(columnName); } } //if the response is blank then remove that row dtNew.RemoveBlankRow(PValues); //...and export them string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }
public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); //Get the response, treatment and covariate columns by removing all other columns from the new datatable foreach (string col in dtNew.GetVariableNames()) { if (Response != col && GroupingFactor != col && ResponseCategories != col) { dtNew.Columns.Remove(col); } } //if the response is blank then remove that row dtNew.RemoveBlankRow(Response); string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }
public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); //Get the response, treatment and covariate columns by removing all other columns from the new datatable foreach (string columnName in dtNew.GetVariableNames()) { if (!Responses.Contains(columnName)) { dtNew.Columns.Remove(columnName); } } //Now do transformations foreach (string resp in Responses) { dtNew.TransformColumn(resp, ResponseTransformation); } string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }
public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); //Get the response, treatment and covariate columns by removing all other columns from the new datatable if (!IncludeAllVariables) //ONLY if "include all variables" is not selected { foreach (string columnName in dtNew.GetVariableNames()) { if (!Responses.Contains(columnName) && (SubjectFactor == null || !SubjectFactor.Contains(columnName)) && (SelectedVariables == null || !SelectedVariables.Contains(columnName))) { dtNew.Columns.Remove(columnName); } } } string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }
public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); foreach (string col in this.DataTable.GetVariableNames()) { if (Response != col && XAxis != col && FirstCatFactor != col && SecondCatFactor != col && CaseIDFactor != col) { dtNew.Columns.Remove(col); } } //if the response is blank then remove that row dtNew.RemoveBlankRow(Response); //Now do transformations... dtNew.TransformColumn(Response, ResponseTransformation); if (!String.IsNullOrEmpty(XAxis)) //check that an x axis var is selected { dtNew.TransformColumn(XAxis, XAxisTransformation); } string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }
public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); //Get the response, treatment and covariate columns by removing all other columns from the new datatable foreach (string columnName in dtNew.GetVariableNames()) { if (!Responses.Contains(columnName) && CategoricalPredictor != columnName && (ContinuousPredictors == null || !ContinuousPredictors.Contains(columnName)) && CaseID != columnName) { dtNew.Columns.Remove(columnName); } } //if the response is blank then remove that row foreach (string response in Responses) { dtNew.RemoveBlankRow(response); } //Now do transformations... foreach (string response in Responses) { dtNew.TransformColumn(response, ResponseTransformation); } string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }
public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); //Get the response, treatment and covariate columns by removing all other columns from the new datatable foreach (string columnName in dtNew.GetVariableNames()) { if (Response != columnName && Treatment != columnName && (OtherDesignFactors == null || !OtherDesignFactors.Contains(columnName)) && Subject != columnName && (Covariates == null || !Covariates.Contains(columnName))) { dtNew.Columns.Remove(columnName); } } //if the response is blank then remove that row dtNew.RemoveBlankRow(Response); //Now do transformations... dtNew.TransformColumn(Response, ResponseTransformation); if (Covariates != null) { foreach (string covariate in Covariates) { dtNew.TransformColumn(covariate, CovariateTransformation); } } //Finally, as numeric categorical variables get misinterpreted by r, we need to go through //each column and put them in quotes... if (OtherDesignFactors != null) { foreach (string odf in OtherDesignFactors) { if (dtNew.CheckIsNumeric(odf)) { foreach (DataRow row in dtNew.Rows) { row[odf] = "'" + row[odf] + "'"; } } } } string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }
public void ConvertIllegalCharacters_StringWithAllIllegalChars_ReturnsCorrectString() { //Arrange System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; ArgumentFormatter sut = new ArgumentFormatter(); //Act string nastyString = " ()/%#.-@:!\"£$^&{};|\\[]=<>'"; string result = sut.ConvertIllegalCharacters(nastyString); //Assert Assert.Equal("ivs_sp_ivsivs_ob_ivsivs_cb_ivsivs_div_ivsivs_pc_ivsivs_hash_ivsivs_pt_ivsivs_hyphen_ivsivs_at_ivsivs_colon_ivsivs_exclam_ivsivs_dblquote_ivsivs_pound_ivsivs_dollar_ivsivs_hat_ivsivs_amper_ivsivs_obrace_ivsivs_cbrace_ivsivs_semi_ivsivs_pipe_ivsivs_slash_ivsivs_osb_ivsivs_csb_ivsivs_eq_ivsivs_lt_ivsivs_gt_ivsivs_quote_ivs", result); }
public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); //Get the response and treatment columns foreach (string columnName in dtNew.GetVariableNames()) { if (Response != columnName && Dose != columnName && QCResponse != columnName && QCDose != columnName && SamplesResponse != columnName && EquationYAxis != columnName && EquationXAxis != columnName) { dtNew.Columns.Remove(columnName); } } if (AnalysisType == AnalysisOption.FourParameter) { dtNew.RemoveBlankRow(Response); } else { //if the y axis column is blank then remove that row dtNew.RemoveBlankRow(EquationYAxis); } //Now do transformations... if (!String.IsNullOrEmpty(Response)) //transform ResponseVar { dtNew.TransformColumn(Response, ResponseTransformation); } if (!String.IsNullOrEmpty(QCResponse)) //transform QCResponseVar { dtNew.TransformColumn(QCResponse, ResponseTransformation); } if (!String.IsNullOrEmpty(SamplesResponse)) //transform SamplesVar { dtNew.TransformColumn(SamplesResponse, ResponseTransformation); } string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }
public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); //Get the response, treatment and covariate columns by removing all other columns from the new datatable foreach (string columnName in dtNew.GetVariableNames()) { if (!VariableA.Contains(columnName) && (VariableB == null || !VariableB.Contains(columnName)) && (VariableC == null || !VariableC.Contains(columnName) && (VariableD == null || !VariableD.Contains(columnName)))) { dtNew.Columns.Remove(columnName); } } string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }
public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); //Get the response, treatment and covariate columns by removing all other columns from the new datatable foreach (string columnName in dtNew.GetVariableNames()) { if (Response != columnName && !Treatments.Contains(columnName) && (OtherDesignFactors == null || !OtherDesignFactors.Contains(columnName)) && (Covariates == null || !Covariates.Contains(columnName))) { dtNew.Columns.Remove(columnName); } } //if the response is blank then remove that row dtNew.RemoveBlankRow(Response); //Generate a "catfact" column from the CatFactors (used only in R)! DataColumn catFactor = new DataColumn("catfact"); dtNew.Columns.Add(catFactor); //Need to create a new column for the scatterplot data as we have to combine any interaction effects into one column dtNew.CreateCombinedEffectColumn(Treatments, "scatterPlotColumn"); //If an interaction effect is selected then we need to combine values into single column if (!String.IsNullOrEmpty(SelectedEffect)) { //create a new column and add it to the table if (SelectedEffect.Contains(" * ")) //then it is an interaction effect so we need to combine values from different columns { char[] splitChar = { '*' }; string[] effects = SelectedEffect.Split(splitChar, StringSplitOptions.RemoveEmptyEntries); //get the effect names that make up the interaction effect dtNew.CreateCombinedEffectColumn(effects, "mainEffect"); } else //just copy the column selected in the dropdown { DataColumn mainEffect = new DataColumn("mainEffect"); dtNew.Columns.Add(mainEffect); foreach (DataRow r in dtNew.Rows) { r["mainEffect"] = r[SelectedEffect].ToString(); } } } //Now do transformations... dtNew.TransformColumn(Response, ResponseTransformation); if (Covariates != null) { foreach (string covariate in Covariates) { dtNew.TransformColumn(covariate, CovariateTransformation); } } //Finally, as numeric categorical variables get misinterpreted by r, we need to go through //each column and put them in quotes... foreach (string treat in Treatments) { if (dtNew.CheckIsNumeric(treat)) { foreach (DataRow row in dtNew.Rows) { row[treat] = "'" + row[treat] + "'"; } } } if (OtherDesignFactors != null) { foreach (string odf in OtherDesignFactors) { if (dtNew.CheckIsNumeric(odf)) { foreach (DataRow row in dtNew.Rows) { row[odf] = "'" + row[odf] + "'"; } } } } string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }
public override string[] ExportData() { DataTable dtNew = DataTable.CopyForExport(); //Get the response, treatment and covariate columns by removing all other columns from the new datatable foreach (string columnName in dtNew.GetVariableNames()) { if (!Responses.Contains(columnName) && FirstCatFactor != columnName && SecondCatFactor != columnName && ThirdCatFactor != columnName && FourthCatFactor != columnName) { dtNew.Columns.Remove(columnName); } } //Generate a "catfact" column from the CatFactors! DataColumn catFactor = new DataColumn("catfact"); dtNew.Columns.Add(catFactor); foreach (DataRow r in dtNew.Rows) //go through each row... { string firstCatFactorValue = null; string secondCatFactorValue = null; string thirdCatFactorValue = null; string fourthCatFactorValue = null; if (!String.IsNullOrEmpty(FirstCatFactor)) { firstCatFactorValue = r[FirstCatFactor].ToString() + " "; } if (!String.IsNullOrEmpty(SecondCatFactor)) { secondCatFactorValue = r[SecondCatFactor].ToString() + " "; } if (!String.IsNullOrEmpty(ThirdCatFactor)) { thirdCatFactorValue = r[ThirdCatFactor].ToString() + " "; } if (!String.IsNullOrEmpty(FourthCatFactor)) { fourthCatFactorValue = r[FourthCatFactor].ToString(); } string catFactorValue = firstCatFactorValue + secondCatFactorValue + thirdCatFactorValue + fourthCatFactorValue; r["catfact"] = catFactorValue.Trim(); //copy the cat factor to the new column } //Now do transformations foreach (string resp in Responses) { dtNew.TransformColumn(resp, Transformation); } string[] csvArray = dtNew.GetCSVArray(); //fix any columns with illegal chars here (at the end) ArgumentFormatter argFormatter = new ArgumentFormatter(); csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); return(csvArray); }