public static string ScaleToNominalOrOrdinal(string colName, List<FactorMap> fmap, string changeTo, ServerDataSource dataSource)
{
string numericVector = "c(";
string stringVector = "c(";
int i = 0;
foreach (FactorMap fm in fmap)
{
if (i < fmap.Count - 1)//put comma
{
//numericVector = numericVector + fm.labels + ",";moved inside else block. so for balnks we are dropping numerics also
if (fm.textbox.Trim().Length == 0)
{
//stringVector = stringVector + "\'\',";//blank for NA // blanks are not sent to R. Drop them.
}
else
{
stringVector = stringVector + "\'" + fm.textbox + "\',";
numericVector = numericVector + fm.labels + ",";
}
}
else
{
//numericVector = numericVector + fm.labels + ")"; moved inside else block. so for balnks we are dropping numerics also
if (fm.textbox.Trim().Length == 0)
{
//stringVector = stringVector + "\'\'";//blank for NA. // blanks are not sent to R. Drop them.
}
else
{
stringVector = stringVector + "\'" + fm.textbox + "\')";
numericVector = numericVector + fm.labels + ")";
}
}
i++;
}
return string.Format("BSkyScaleToNominalOrOrdinal(colNameOrIndex='{0}', numericValues={1}, levelNames={2}, changeto='{3}', dataSetNameOrIndex='{4}')", colName, numericVector, stringVector, changeTo, dataSource.Name);
}