symdim | R Documentation |
Get symbolic dimension of a statement (as an R code)
symdim(st, env = parent.frame(), dim_tab = NULL)
st |
A statements, i.e. an item in a list obtained as result of e.g. quote(a+b) or expression(a+b) |
env |
An environement where a statement can be executed to get its type and structure. |
dim_tab |
A named list caching symbolic dimensions for R symbols. |
If some error occurs, a NA is returned
The objects from the statement st
are searched for in env
if dim_tab is NULL or an object is not there.
a character vector:
of legth 2 for a matrix mat
, it returns
c("nrow(mat)", "ncol(mat)")
of length 1 for a vector, e.g. "length(vec)"
a string "1" for a scalar
a=b=c=1:2
lapply(parse(t="x <- a%*%(b+c); y=a+b"), symdim)
# or
symdim(expression(x <- a%*%(b+c))[[1L]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.