Variable structure in Global environment

Hello,

I am having a problem with the variable structure displayed in the Environment. For instance, if I put the code below:

m2 <- matrix(c("a", "b",
"c", "d"),
nrow = 2,
byrow = T)

and check the structure of m2 with str(m2), it returns

str(m2)
chr [1:2, 1:2] "a" "c" "b" "d"

However, chr [1:4] "a" "c" "b" "d" is displayed in the Global Environment (as below).

I am not sure why this is happening and I would like to seek advice to fix this.

Thank you in advance!

1 Like

I believe it is a bug in RStudio. For a logical/integer/double matrix or array, the display is as expected, but for character it has this behavior. I can reproduce with RStudio 2021.09.1+372 "Ghost Orchid" Release (8b9ced188245155642d024aa3630363df611088a, 2021-11-08) for Windows.