Export R table to include curly brackets

Viewed 40

I have a matrix in R and need to use it as input in another software where the rows need to be wrapped in curly brackets, e.g.

{{0,2,-2,0},{-1,1,1,1}}

One way is to extract each row separately and then concatenate curly brackets but I'm wondering whether there is a more intelligent way to do this. Thank you!

m <- matrix(c(0,2,-2,0,-1,1,1,1), 2, byrow = TRUE)
0 Answers
Related