The cgraph package supports many of the base R functions. The table below shows all operators that are currently supported and the corresponding base expression to which they correspond.

S3 Overloaded Operators

Operator Base R Expression
cg_pos(x) `+`(x)
cg_add(x, y) `+`(x, y)
cg_neg(x) `-`(x)
cg_sub(x, y) `-`(x, y)
cg_mul(x, y) `*`(x. y)
cg_div(x, y) `/`(x, y)
cg_pow(x, y) `^`(x, y)
cg_subset1(x, ...) `[`(x, ...)
cg_subset2(x, ...) `[[`(x, ...)

Vector Operators

Operator Base R Expression
cg_length(x) length(x)
cg_as_double(x) as.double(x)
cg_as_numeric(x) as.numeric(x)
cg_square(x) `^`(x, 2)
cg_sqrt(x) sqrt(x)
cg_exp(x) exp(x)
cg_ln(x) log(x)
cg_log2(x) log2(x)
cg_log10(x) log10(x)
cg_abs(x) abs(x)
cg_sin(x) sin(x)
cg_cos(x) cos(x)
cg_tan(x) tan(x)
cg_sinh(x) sinh(x)
cg_cosh(x) cosh(x)
cg_tanh(x) tanh(x)
cg_asin(x) asin(x)
cg_acos(x) acos(x)
cg_atan(x) atan(x)
cg_asinh(x) asinh(x)
cg_acosh(x) acosh(x)
cg_atanh(x) atanh(x)
cg_sigmoid(x) 1 / (1 + exp(-x))

Array Operators

Operator Base R Expression
cg_dim(x) dim(x)
cg_nrow(x) nrow(x)
cg_ncol(x) ncol(x)
cg_matmul(x) x %*% y
cg_crossprod(x, y) crossprod(x, y)
cg_tcrossprod(x, y) tcrossprod(x, y)
cg_linear(x, y, z) x %*% y + c(z)
cg_sum(x) sum(x)
cg_prod(x) prod(x)
cg_rowsums(x) rowSums(x)
cg_colsums(x) colSums(x)
cg_mean(x) mean(x)
cg_rowmeans(x) rowMeans(x)
cg_colmeans(x) colMeans(x)
cg_max(x) max(x)
cg_min(x) min(x)
cg_pmax(x) pmax(x)
cg_pmin(x) pmin(x)
cg_t(x) t(x)