Re: [R] Accessing Named Column in a Matrix

From: Kenn Konstabel <>
Date: Wed, 25 Jun 2008 17:31:18 +0300

 On Mon, Jun 23, 2008 at 9:12 PM, Gundala Viswanath <> wrote:
> I've also tried with
> data$var
> But still fail to access "var" column

you can't use $ with matrices (see help("$") !!!!!), but you can use [ with names, or convert you matrix to a data frame:

myData[, "var"]$var


On Tue, Jun 24, 2008 at 5:07 AM, jim holtman <> wrote:

> It does not appear that the 'print' statment agrees with the output of
> 'str'. It appears that you only have a 3x2 matrix in the 'print',
> while the 'str' indicates a 150x80 matrix. Can you "provide
> commented, minimal, self-contained, reproducible code" so it is easier
> to see what the problem might be.
> Also you might choose another name besides 'data' since that is also a
> function in R.

        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 25 Jun 2008 - 14:55:22 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 25 Jun 2008 - 15:01:17 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive