powered by
Variables are detected as a character followed by a number of either: character, number or underscore.
as_symbol(x, declare_variables = TRUE)
R object to convert to a symbol
declare detected variables automatically
Default is to declare used variables. Alternatively, the user must declare them first, e.g. by symbol().
symbol()
Note that matrices can be defined by specifying a Python matrix, see below in examples.
# NOT RUN { if (have_sympy()) { x <- symbol("x") A <- matrix(c("x", 0, 0, "2*x"), 2, 2) A B <- as_symbol(A) B 2*B dim(B) sqrt(B) D <- as_symbol("[[1, 4, 5], [-5, 8, 9]]") D } # }
Run the code above in your browser using DataLab