Exemplo n.º 1
0
        public object Clone()
        {
            var factorInfo = new clsFactorInfo(mstrFactor)
            {
                marrValues = MakeDeepCopy(marrValues)
            };

            return(factorInfo);
        }
Exemplo n.º 2
0
        public object Clone()
        {
            var factorInfo = new clsFactorInfo(mstrFactor)
            {
                marrValues = MakeDeepCopy(marrValues)
            };

            return factorInfo;
        }
Exemplo n.º 3
0
        private void UpdateFactorInfoArray()
        {
            var marrFV = new List<string>();

            marrFactorInfo.Clear();
            try
            {
                mRConnector.EvaluateNoReturn("factorNames <- rownames(factors)");
                var factorNames = mRConnector.GetSymbolAsStrings("factorNames");
                var factors = factorNames;
                for (var numF = 0; numF < factors.Length; numF++)
                {
                    marrFV.Clear();
                    mRConnector.EvaluateNoReturn("fVals <- unique(factors[" +
                        Convert.ToString(numF + 1) + ",])");
                    mRConnector.EvaluateNoReturn("nfVals <- length(fVals)");

                    var factorValues = mRConnector.GetSymbolAsStrings("fVals");
                    var factorCounts = mRConnector.GetSymbolAsNumbers("nfVals");

                    if ((int)factorCounts[0] > 1)
                    {
                        //more than one factor value
                        marrFV.AddRange(factorValues);
                    }
                    else
                    {
                        marrFV.Add(factorValues[0]);
                    }

                    var currFactorInfo = new clsFactorInfo
                    {
                        SetFvals = marrFV,
                        mstrFactor = factors[numF]
                    };

                    marrFactorInfo.Add(currFactorInfo);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Exception while talking to R");
            }
        }
Exemplo n.º 4
0
        private void Add_Factor()
        {
            var tmpfactorInfo = new clsFactorInfo();

            if (lstBoxFactors.Items.Count == MAX_LEVELS)
                MessageBox.Show("Maximum number of factors reached!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            else if (txtBoxFactors.Text != "")
            {
                var strFactor = txtBoxFactors.Text.Replace(" ", "_");
                if (Array.IndexOf(strarrFactors, strFactor) < 0)
                { // no duplicates
                    txtBoxFactors.Text = "";
                    tmpfactorInfo.mstrFactor = strFactor;
                    marrFactors.Add(tmpfactorInfo);
                    lstBoxFactors.Items.Add(strFactor);
                    lstBoxFactors.SelectedIndex = -1;
                    strarrFactors[numFactors] = strFactor;
                    numFactors++;
                }
                else
                {
                    MessageBox.Show("You have already entered this factor!", "Existing Factor", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }