[R] xtable with psych objects

Marc Schwartz marc_schwartz at me.com
Tue Dec 18 17:42:50 CET 2012


On Dec 18, 2012, at 9:24 AM, Simon Kiss <sjkiss at gmail.com> wrote:

> Hello:
> I s there a way to use xtable with objects from the psych package, particularly principal()?
> Is there a difference between princomp and principal? xtable seems to play better with princomp.
> Thank you.
> Yours, Simon Kiss

I have not used the psych package, so not sure about the differences in the function or what type of object it returns.

xtable has support for:

> methods(xtable)
 [1] xtable.anova*           xtable.aov*            
 [3] xtable.aovlist*         xtable.coxph*          
 [5] xtable.data.frame*      xtable.glm*            
 [7] xtable.lm*              xtable.matrix*         
 [9] xtable.prcomp*          xtable.summary.aov*    
[11] xtable.summary.aovlist* xtable.summary.glm*    
[13] xtable.summary.lm*      xtable.summary.prcomp* 
[15] xtable.table*           xtable.ts*             
[17] xtable.zoo*            


So it would seem that there is a method for 'prcomp' class objects, as opposed to 'princomp', albeit, there are similarities. 

Typically, if there is not a built-in method for a given class, you would need to create an object of a class that is supported, containing the results that you want to output. So that could perhaps be either a matrix or a data frame, which ever is more suitable for your case.

Regards,

Marc Schwartz




More information about the R-help mailing list