[R-SIG-Mac] Accessing matrix elements

R. Michael Weylandt michael.weylandt at gmail.com
Mon Apr 9 00:02:40 CEST 2012


This really isn't a question for the R-SIG-Mac list, since it's not OS
specific; you might send this to R-Help.

That's not a matrix -- just how the print statement works. E.g., if I
print a long vector (1:1000) you'll see those little [1] boxes showing
up on each line to indicate position. Note the result of
is.matrix(x[1,1])

Incidentally, keep in mind that *everything* including scalars and
matrices in R is a vector so "pure elements" are themselves vectors.

Hope this

On Sun, Apr 8, 2012 at 5:55 PM, Holger Schulz <qdl at gmx.net> wrote:
> Assuming I have a matrix x like
>
>        x <- array(1:20, dim=c(4,5))
>
> and I try to access one of its elements like
>
>        [1,1]
>
> result will be
>
>        [1] 1
>
> which looks like a (singleton) matrix itself.
>
> Can the pure elements be accessed?
>
> Thanks.
>
> hs
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list