コード例 #1
0
 @operator(
     value = "R_compute",
     can_be_const = false,
     content_type = IType.LIST,
     index_type = IType.STRING,
     category = {IOperatorCategory.STATISTICAL})
 @doc(
     deprecated = "Use R_file instead",
     value =
         "returns the value of the last left-hand operand of given R file (right-hand operand) in given vector  (left-hand operand).",
     examples = {
       @example(value = "file f <- file('Correlation.r');", isTestOnly = true),
       @example(value = "save \"x <- c(1, 2, 3);\" to: f.path;", isTestOnly = true),
       @example(value = "save \"y <- c(1, 2, 4);\" to: f.path;", isTestOnly = true),
       @example(value = "save \"result<- cor(x, y);\" to: f.path;", isTestOnly = true),
       @example(
           value = "R_compute('Correlation.R')",
           var = "result",
           equals = "['result'::['0.981980506061966']]"),
       @example("////// Correlation.R file:"),
       @example("// x <- c(1, 2, 3);"),
       @example("// y <- c(1, 2, 4);"),
       @example("// result <- cor(x, y);"),
       @example("// Output:"),
       @example("// result::[0.981980506061966]")
     })
 @Deprecated
 public static GamaMap opRFileEvaluate(final IScope scope, final String RFile)
     throws GamaRuntimeException, ParseException, ExecutionException {
   RFile obj = new RFile(scope, RFile);
   return obj.getContents(scope);
 }
コード例 #2
0
 @operator(
     value = "R_compute_param",
     can_be_const = false,
     type = IType.MAP,
     content_type = IType.LIST,
     index_type = IType.STRING,
     category = {IOperatorCategory.STATISTICAL})
 @doc(
     deprecated = "Use R_file instead",
     value =
         "returns the value of the last left-hand operand of given R file (right-hand operand) in given vector  (left-hand operand), R file (first right-hand operand) reads the vector (second right-hand operand) as the parameter vector",
     examples = {
       @example(value = "file f <- file('AddParam.r');", isTestOnly = true),
       @example(value = "save \"v1 <- vectorParam[1];\" to: f.path;", isTestOnly = true),
       @example(value = "save \"v2<-vectorParam[2];\" to: f.path;", isTestOnly = true),
       @example(value = "save \"v3<-vectorParam[3];\" to: f.path;", isTestOnly = true),
       @example(value = "save \"result<-v1+v2+v3;\" to: f.path;", isTestOnly = true),
       @example("list<int> X <- [2, 3, 1];"),
       @example(
           value = "R_compute_param('AddParam.R', X)",
           var = "result",
           equals = "['result'::['6']]"),
       @example("////// AddParam.R file:"),
       @example("// v1 <- vectorParam[1];"),
       @example("// v2<-vectorParam[2];"),
       @example("// v3<-vectorParam[3];"),
       @example("// result<-v1+v2+v3;"),
       @example("////// Output:"),
       @example("// 'result'::[6]")
     })
 @Deprecated
 public static GamaMap operateRFileEvaluate(
     final IScope scope, final String RFile, final IContainer param)
     throws GamaRuntimeException, ParseException, ExecutionException {
   RFile obj = new RFile(scope, RFile, param);
   return obj.getContents(scope);
 }