Learn R Programming

symSEM (version 0.1)

as.matrix: Convert a Ryacas Symbolic Matrix to a Character Matrix

Description

It converts a Ryacas Symbolic Matrix to a Character Matrix in R.

Usage

# S3 method for yac_symbol
as.matrix(x, ...)

Value

A character matrix.

Arguments

x

A symbolic matrix of class "yac_symbol".

...

not used

Author

Mike W.-L. Cheung <mikewlcheung@nus.edu.sg>

See Also

sym

Examples

Run this code
## Create a character matrix
A1 <- matrix(c(1, 2, 3, "a", "b", "c"), ncol=2, nrow=3)
#      [,1] [,2]
# [1,] "1"  "a" 
# [2,] "2"  "b" 
# [3,] "3"  "c"

## Convert it to an Ryacas matrix for symbolic calculations
A2 <- sym(A1)
# {{1, a},
#  {2, b},
#  {3, c}} 

## Convert it back to a character matrix
as.matrix(A2)
#      [,1] [,2]
# [1,] "1"  "a" 
# [2,] "2"  "b" 
# [3,] "3"  "c" 

Run the code above in your browser using DataLab