nuget server logo nuget api documents
↑

API Docs / REnv / applys

applys

Full name SMRUCC.Rsharp.Runtime.Internal.Invokes.applys Assembly REnv Members 6

01 Syntax

SMRUCC.Rsharp.Runtime.Internal.Invokes.applys

02 Methods

NameOverloadsSummary
apply 1 Apply Functions Over Array Margins Returns a vector or array or list of values obtained by applying a function to margins of an array or matrix.
parLapply 1 Parallel version of lapply.
parSapply 1 parallel sapply
checkInternal 1 check for the argument error
sapply 1 Apply a Function over a List or Vector sapply is a user-friendly version and wrapper of lapply by default returning a vector, matrix or, if simplify = "array", an array if a…
lapply 1 Apply a Function over a List or Vector lapply returns a list of the same length as X, each element of which is the result of applying FUN to the corresponding element of X.

03 Members

method apply #
apply(Object, margins, Object, Environment)

Apply Functions Over Array Margins

Returns a vector or array or list of values obtained by applying a function to margins of an array or matrix.

Remarks

If X is not an array but an object of a class with a non-null dim value (such as a data frame), apply attempts to coerce it to an array via as.matrix if it is two-dimensional (e.g., a data frame) or via as.array.

FUN Is found by a call to match.fun And typically Is either a function Or a symbol (e.g., a backquoted name) Or a character string specifying a function to be searched for from the environment of the call to apply.

Arguments in ... cannot have the same name as any of the other arguments, And care may be needed to avoid partial matching to MARGIN Or FUN. In general-purpose code it Is good practice to name the first three arguments if ... Is passed through: this both avoids Partial matching To MARGIN Or FUN And ensures that a sensible Error message Is given If arguments named X, MARGIN Or FUN are passed through ....

Parameters
NameTypeDescription
xObject

an array, including a matrix.

marginmargins

a vector giving the subscripts which the function will be applied over. E.g., for a matrix 1 indicates rows, 2 indicates columns, c(1, 2) indicates rows and columns. Where X has named dimnames, it can be a character vector selecting dimension names.

FUNObject

the function to be applied: see ‘Details’. In the case of functions like +, %*%, etc., the function name must be backquoted or quoted.

envEnvironment

-

Returns

If each call to FUN returns a vector of length n, then apply returns an array of dimension c(n, dim(X)[MARGIN]) if n > 1. If n equals 1, apply returns a vector if MARGIN has length 1 and an array of dimension dim(X)[MARGIN] otherwise. If n is 0, the result has length 0 but not necessarily the ‘correct’ dimension.

If the calls To FUN Return vectors Of different lengths, apply returns a list Of length prod(Dim(X)[MARGIN]) With Dim Set To MARGIN If this has length greater than one.

In all cases the result Is coerced by as.vector to one of the basic vector types before the dimensions are set, so that (for example) factor results will be coerced to a character array.

method parLapply #
parLapply(list, Object, Int32, Int32, Nullable(Of Boolean), String(), Environment)

Parallel version of lapply.

Parameters
NameTypeDescription
xlist

-

FUNObject

-

groupInt32

-

n_threadsInt32

-

verboseNullable(Of Boolean)

-

namesString()

Set new names to the result list, the size of this parameter should be equals to the size of the original input sequence size.

envEnvironment

-

method parSapply #
parSapply(Object, Object, Int32, Int32, Nullable(Of Boolean), Environment)

parallel sapply

method checkInternal #
checkInternal(Object, Object, Environment)

check for the argument error

Remarks

this function will convert the FUN from a clr MethodInfo pointer to RMethodInfo automatically.

Parameters
NameTypeDescription
XObject

check for the input argument, should be nothing if no needed

FUNObject

should be implements a R# function interface.

envEnvironment

-

Returns

this function returns nothing if no errors, otherwise a error message will be generated if:

  1. the input X may be a error message, or
  2. the given FUN is not implements the RFunction interface.
method sapply #
sapply(Object, Object, Boolean, Environment)

Apply a Function over a List or Vector

sapply is a user-friendly version and wrapper of lapply by default returning a vector, matrix or, if simplify = "array", an array if appropriate, by applying simplify2array(). sapply(x, f, simplify = FALSE, USE.NAMES = FALSE) is the same as lapply(x, f).

Parameters
NameTypeDescription
XObject

a vector (atomic or list) or an expression object. Other objects (including classed objects) will be coerced by base::as.list.

FUNObject

the Function to be applied To Each element Of X: see 'Details’. In the case of functions like +, %*%, the function name must be backquoted or quoted.

streamBoolean

run in lazy stream mode? default is not.

envirEnvironment

-

method lapply #
lapply(Object, Object, Object, Environment)

Apply a Function over a List or Vector

lapply returns a list of the same length as X, each element of which is the result of applying FUN to the corresponding element of X.

Parameters
NameTypeDescription
XObject

a vector (atomic or list) or an expression object. Other objects (including classed objects) will be coerced by base::as.list.

FUNObject

the Function to be applied To Each element Of X: see 'Details’. In the case of functions like +, %*%, the function name must be backquoted or quoted. and optional index of function secondary parameter, start from base 1.

envirObject

-