private static RData checkEmptyValue(JToken jparent, String type, String rclass, String name)
        {
            RData data = null;

            if (!(jparent["value"] == null))
            {
                return null;
            }

            if (type == Constants.TYPE_MATRIX)
            {
                if (rclass == Constants.RCLASS_NUMERIC)
                {
                    data = new RNumericMatrix(name, null);
                }
                else if (rclass == Constants.RCLASS_CHARACTER)
                {
                    data = new RStringMatrix(name, null);
                }
                else if (rclass == Constants.RCLASS_BOOLEAN)
                {
                    data = new RBooleanMatrix(name, null);
                }
                else
                {
                    data = new RNumericMatrix(name, null);
                }
            }
            else if (type == Constants.TYPE_VECTOR)
            {
                if (rclass == Constants.RCLASS_NUMERIC)
                {
                    data = new RNumericVector(name, null);
                }
                else if (rclass == Constants.RCLASS_CHARACTER)
                {
                    data = new RStringVector(name, null);
                }
                else if (rclass == Constants.RCLASS_BOOLEAN)
                {
                    data = new RBooleanVector(name, null);
                }
                else if (rclass == Constants.RCLASS_DATE)
                {
                    data = new RDateVector(name, null, "");
                }
                else
                {
                    data = new RNumericVector(name, null);
                }
            }
            else if (type == Constants.TYPE_PRIMITIVE)
            {
                if (rclass == Constants.RCLASS_NUMERIC)
                {
                    data = new RNumeric(name, 0);
                }
                else if (rclass == Constants.RCLASS_CHARACTER)
                {
                    data = new RString(name, null);
                }
                else if (rclass == Constants.RCLASS_BOOLEAN)
                {
                    data = new RBoolean(name, false);
                }
                else
                {
                    data = new RNumeric(name, 0);
                }
            }
            else if (type == Constants.TYPE_DATE)
            {
                data = new RDate(name, null, "");
            }
            else if (type == Constants.TYPE_FACTOR)
            {
                data = new RFactor(name, null);
            }
            else if (type == Constants.TYPE_DATAFRAME)
            {
                data = new RDataFrame(name, null);
            }
            else if (type == Constants.TYPE_LIST)
            {
                data = new RList(name, null);
            }

            return data;
        }
        /// <summary>
        /// Create the appropriate RData class representing a matrix (RNumericVector, RBooleanVector, RStringVector, RDateVector)
        /// </summary>
        /// <param name="name">name of the RData instance</param>
        /// <param name="jparent">Parent json.net object</param>
        /// <param name="rclass">R class of the object to create</param>
        /// <returns>RData object</returns>
        /// <remarks></remarks>
        public static RData parseVector(String name, JToken jparent, String rclass)
        {
            RData data = null;

            List<Double?> numList = new List<Double?>();
            List<String> charList = new List<String>();
            List<Boolean?> logList = new List<Boolean?>();
            List<String> dateList = new List<String>();

            if (!(jparent["value"] == null))
            {
                JArray jvalues = jparent["value"].Value<JArray>();
                foreach (var j in jvalues)
                {
                    if (j.Type != JTokenType.Null)
                    {
                        if (rclass == Constants.RCLASS_NUMERIC)
                        {
                            numList.Add(j.Value<double>());
                        }
                        else if (rclass == Constants.RCLASS_CHARACTER)
                        {
                            charList.Add(j.Value<string>());
                        }
                        else if (rclass == Constants.RCLASS_BOOLEAN)
                        {
                            logList.Add(j.Value<bool>());
                        }
                        else if (rclass == Constants.RCLASS_DATE)
                        {
                            dateList.Add(j.Value<string>());
                        }
                    }
                    else
                    {
                        if (rclass == Constants.RCLASS_NUMERIC)
                        {
                            numList.Add(null);
                        }
                        else if (rclass == Constants.RCLASS_CHARACTER)
                        {
                            charList.Add(null);
                        }
                        else if (rclass == Constants.RCLASS_BOOLEAN)
                        {
                            logList.Add(null);
                        }
                        else if (rclass == Constants.RCLASS_DATE)
                        {
                            dateList.Add(null);
                        }
                    }
                }
            }

            if (rclass == Constants.RCLASS_NUMERIC)
            {
                data = new RNumericVector(name, numList);
            }
            else if (rclass == Constants.RCLASS_CHARACTER)
            {
                data = new RStringVector(name, charList);
            }
            else if (rclass == Constants.RCLASS_BOOLEAN)
            {
                data = new RBooleanVector(name, logList);
            }
            else if (rclass == Constants.RCLASS_DATE)
            {
                String f = jparent["format"].Value<string>();
                data = new RDateVector(name, dateList, f);
            }

            return data;
        }