How to call matrix given its name as a string in R?

Viewed 25

Say I have a matrix A, and I have a string "A", given the string "A", how can I call the matrix A?

1 Answers

Try get:

A <- matrix(c(1,2), 2, 1)
get('A')
# [,1]
# [1,]    1
# [2,]    2
Related