[R] Extracting data from Eigen function

Rolf Turner r.turner at auckland.ac.nz
Tue Mar 4 01:48:16 CET 2008


Use

	mat <- eig[["vectors"]]

If x is a list, ``x[i]'' gives you a (sub-) list of length 1,
whereas ``x[[i]]'' gives you the single element of that list.
A possibly subtle but important distinction.

	cheers,

		Rolf Turner

On 4/03/2008, at 12:42 PM, SS-R wrote:

>
> Hi
> I need to extract the data returned by Eigen to plot the eigenvectors.
> However, when I try and eigv = eigen(covariance); it returns an  
> object with
> the matrices containing eigenvalues and vectors.. how can I extract  
> the
> eigenvector matrix from this??
>
> When I try mat = eig["vectors"] it returns a matrix with the  
> "$vectors"
> string on top , how can I remove this?
>
> code:
>> eig
> $values
> [1] 1.2840277 0.0490834
>
> $vectors
>           [,1]       [,2]
> [1,] 0.6778734 -0.7351787
> [2,] 0.7351787  0.6778734
>
>
> -- 
> View this message in context: http://www.nabble.com/Extracting-data- 
> from-Eigen-function-tp15816996p15816996.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting- 
> guide.html
> and provide commented, minimal, self-contained, reproducible code.


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list