[R] factor analysis (pca): how to get the 'communalities'?

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Jan 4 14:48:03 CET 2003


Wolfgang Lindner wrote:
> 
> Brett Magill schrieb:
> | If interested, on my web site I have code to do factor analysis by PC.  Does
> | exactly as below, but a nice wrapper to print methods, rotations, sorting, and
> | other conveniences.
> |
> |   home.earthlink.net/~bmagill/MyMisc.html
> |
> | The relevant code snipets are "prinfact", "plot.pfa", and "print.pfa", along
> | with the other required functions as indiciated on the web site.
> 
> Dear Brett,
> 
> thanks very much for supplying your code. It's really illuminating.
> Now, let me quote you
>  'When I have time, I will document them and wrap them up into a package that
>   can be installed.'
> I hope you will find some time to prepare 'Your'Misc-1.0.R ;-) ..
> Helpful could be to give some examples of calling your functions.
> 
> Please excuse me, if the following questions are *too* off-topic, but I found it
> interesting. In inspecting your code I came across an R feature, I could not
> find in the online manuals:
> 
> Q1. Looking at the left-handside in your function def:
> 
> "cov.cor" <- function ( covmat ) {
>                         sdev <- diag ( sqrt ( diag ( covmat ) ) )
>                         solve(sdev) %*% covmat %*% t(solve(sdev))  }
> ^       ^
> |       |
> ?       ?
> 
> - *Why* is the (identifier) function name cov.cor included in question marks?

It's not necessary for this particular name to put in in quotes, but you
can put any name in quotes:

 "x" <- 5
 x

Here you must quote (BAD idea to choose such names!, NOT
recommended!!!):
 "x 1" <- 5
 get("x 1")


> - How is "cov.cor" then called?  "cov.cor"(..) or cov.cor(..) or ?

Both ways are possible in this case.


> Q2. Please, can someone give me a pointer where this feature is described.

R FAQ 7.16 - 2. item in the enumeration.

 
> Finally I want to thank the list for this thread.

Uwe Ligges




More information about the R-help mailing list