R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list('Baiomys_taylori' + ,7.43 + ,63.9 + ,21.99 + ,2.52 + ,10 + ,68.35 + ,20.38 + ,'Dicrostonyx_groenlandicus' + ,58.44 + ,117.32 + ,20.84 + ,3.78 + ,2 + ,38.61 + ,17.42 + ,'Eliomys_quercinus' + ,114.61 + ,138.74 + ,22.97 + ,4.99 + ,1 + ,566.36 + ,34.8 + ,'Lagostomus_maximus' + ,4660.94 + ,523.73 + ,155.73 + ,1.93 + ,1.25 + ,287.76 + ,55.68 + ,'Lagurus_lagurus' + ,20.6 + ,92.52 + ,20.24 + ,4 + ,5.25 + ,41.82 + ,20.84 + ,'Beamys_hindei' + ,75.8 + ,149.23 + ,22.79 + ,3.49 + ,5 + ,181.13 + ,38.49 + ,1 + ,2 + ,3 + ,'Chinchilla_chinchilla' + ,499.99 + ,305 + ,111 + ,2.5 + ,2.5 + ,247.48 + ,48.99 + ,'Castor_canadensis' + ,18124.41 + ,754.74 + ,111.59 + ,3.6 + ,1 + ,663.02 + ,46.5 + ,'Cricetomys_gambianus' + ,1267.52 + ,362.64 + ,31.45 + ,3.11 + ,2 + ,177.08 + ,34.54 + ,'Cuniculus_paca' + ,8172.55 + ,647.06 + ,116.24 + ,1.01 + ,1.75 + ,335.48 + ,82.75 + ,'Cynomys_gunnisoni' + ,797.93 + ,279.12 + ,29.64 + ,4.48 + ,1 + ,395.29 + ,36.65 + ,'Cynomys_leucurus' + ,963.76 + ,307.49 + ,30.39 + ,5.4 + ,1 + ,413.84 + ,31.76 + ,'Cynomys_ludovicianus' + ,797.05 + ,294.04 + ,33.46 + ,4.43 + ,1 + ,696.9 + ,45.57 + ,'Dipodomys_deserti' + ,107.63 + ,138.11 + ,30.5 + ,3.36 + ,2.5 + ,50.88 + ,24.17 + ,'Dipodomys_heermanni' + ,63.08 + ,111.25 + ,30.99 + ,3.11 + ,2 + ,53.13 + ,25.9 + ,'Dipodomys_merriami' + ,37.91 + ,98.54 + ,30.77 + ,2.39 + ,1.75 + ,67.11 + ,20.42 + ,'Dipodomys_microps' + ,56.26 + ,112.47 + ,30.99 + ,2.37 + ,1 + ,147.92 + ,21 + ,'Dipodomys_spectabilis' + ,124.61 + ,141.14 + ,23.5 + ,2.67 + ,2 + ,310.33 + ,23.47 + ,'Dolichotis_patagonum' + ,8000 + ,663.84 + ,97.97 + ,1.75 + ,3.5 + ,216.03 + ,76.28) + ,dim=c(8 + ,19) + ,dimnames=list(c('RodentiaBinomial' + ,'AdultBodyMass_g' + ,'AdultHeadBodyLength_mm' + ,'GestationLength_d' + ,'LitterSize' + ,'LittersPerYear' + ,'SexualMaturityAge_d' + ,'WeaningAge_d') + ,1:19)) > y <- array(NA,dim=c(8,19),dimnames=list(c('RodentiaBinomial','AdultBodyMass_g','AdultHeadBodyLength_mm','GestationLength_d','LitterSize','LittersPerYear','SexualMaturityAge_d','WeaningAge_d'),1:19)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } There were 19 warnings (use warnings() to see them) > par1 = '2' > par1 <- '2' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 () > #Author: root > #To cite this work: Wessa P., 2014, Factor Analysis (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_factor_analysis.wasp/ > #Source of accompanying publication: > # > library(psych) > par1 <- as.numeric(par1) > x <- t(x) > nrows <- length(x[,1]) > ncols <- length(x[1,]) > y <- array(as.double(x[1:nrows,2:ncols]),dim=c(nrows,ncols-1)) There were 13 warnings (use warnings() to see them) > colnames(y) <- colnames(x)[2:ncols] > rownames(y) <- x[,1] > y AdultBodyMass_g AdultHeadBodyLength_mm Baiomys_taylori 7.43 63.90 Dicrostonyx_groenlandicus 58.44 117.32 Eliomys_quercinus 114.61 138.74 Lagostomus_maximus 4660.94 523.73 Lagurus_lagurus 20.60 92.52 Beamys_hindei 75.80 149.23 1 2.00 3.00 2.5 247.48 48.99 1 663.02 46.50 2 177.08 34.54 1.75 335.48 82.75 1 395.29 36.65 1 413.84 31.76 1 696.90 45.57 2.5 50.88 24.17 2 53.13 25.90 1.75 67.11 20.42 1 147.92 21.00 2 310.33 23.47 GestationLength_d LitterSize LittersPerYear Baiomys_taylori 21.99 2.52 10.00 Dicrostonyx_groenlandicus 20.84 3.78 2.00 Eliomys_quercinus 22.97 4.99 1.00 Lagostomus_maximus 155.73 1.93 1.25 Lagurus_lagurus 20.24 4.00 5.25 Beamys_hindei 22.79 3.49 5.00 1 NA 499.99 305.00 2.5 NA 18124.41 754.74 1 NA 1267.52 362.64 2 NA 8172.55 647.06 1.75 NA 797.93 279.12 1 NA 963.76 307.49 1 NA 797.05 294.04 1 NA 107.63 138.11 2.5 NA 63.08 111.25 2 NA 37.91 98.54 1.75 NA 56.26 112.47 1 NA 124.61 141.14 2 NA 8000.00 663.84 SexualMaturityAge_d WeaningAge_d Baiomys_taylori 68.35 20.38 Dicrostonyx_groenlandicus 38.61 17.42 Eliomys_quercinus 566.36 34.80 Lagostomus_maximus 287.76 55.68 Lagurus_lagurus 41.82 20.84 Beamys_hindei 181.13 38.49 1 111.00 2.50 2.5 111.59 3.60 1 31.45 3.11 2 116.24 1.01 1.75 29.64 4.48 1 30.39 5.40 1 33.46 4.43 1 30.50 3.36 2.5 30.99 3.11 2 30.77 2.39 1.75 30.99 2.37 1 23.50 2.67 2 97.97 1.75 > fit <- principal(y, nfactors=par1, rotate='varimax') Warning message: In cor.smooth(r) : Matrix was not positive definite, smoothing was done > fit Principal Components Analysis Call: principal(r = y, nfactors = par1, rotate = "varimax") Standardized loadings (pattern matrix) based upon correlation matrix PC1 PC2 h2 u2 com AdultBodyMass_g 0.91 -0.04 0.83 0.170 1.0 AdultHeadBodyLength_mm 0.98 -0.18 0.99 0.014 1.1 GestationLength_d 0.86 -0.49 0.98 0.025 1.6 LitterSize -0.05 0.99 0.98 0.020 1.0 LittersPerYear -0.18 0.91 0.86 0.136 1.1 SexualMaturityAge_d 0.62 0.06 0.38 0.616 1.0 WeaningAge_d 0.86 -0.33 0.84 0.156 1.3 PC1 PC2 SS loadings 3.67 2.19 Proportion Var 0.52 0.31 Cumulative Var 0.52 0.84 Proportion Explained 0.63 0.37 Cumulative Proportion 0.63 1.00 Mean item complexity = 1.2 Test of the hypothesis that 2 components are sufficient. The root mean square of the residuals (RMSR) is 0.13 with the empirical chi square 13.88 with prob < 0.085 Fit based upon off diagonal values = 0.95> fs <- factor.scores(y,fit) Warning message: In cor.smooth(r) : Matrix was not positive definite, smoothing was done > fs $scores PC1 PC2 Baiomys_taylori -0.24558042 -0.70459460 Dicrostonyx_groenlandicus -0.23965874 -0.68764186 Eliomys_quercinus 0.03158523 0.08986412 Lagostomus_maximus 0.33737788 0.96531493 Lagurus_lagurus -0.24644872 -0.70711396 Beamys_hindei -0.14014122 -0.40255026 1 NA NA 2.5 NA NA 1 NA NA 2 NA NA 1.75 NA NA 1 NA NA 1 NA NA 1 NA NA 2.5 NA NA 2 NA NA 1.75 NA NA 1 NA NA 2 NA NA $weights PC1 PC2 AdultBodyMass_g 0.06915396 0.19823636 AdultHeadBodyLength_mm 0.05020706 0.14385406 GestationLength_d -0.02108492 -0.06069724 LitterSize 0.17135684 0.49170504 LittersPerYear 0.15076312 0.43264861 SexualMaturityAge_d 0.06124555 0.17560404 WeaningAge_d 0.01257094 0.03588563 $r.scores PC1 PC2 PC1 1.0000000 0.9999996 PC2 0.9999996 1.0000000 $R2 PC1 PC2 0.1064620 0.8745033 > postscript(file="/var/wessaorg/rcomp/tmp/10fdn1445625067.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(fs$scores,pch=20) > text(fs$scores,labels=rownames(y),pos=3) > dev.off() null device 1 > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Rotated Factor Loadings',par1+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variables',1,TRUE) > for (i in 1:par1) { + a<-table.element(a,paste('Factor',i,sep=''),1,TRUE) + } > a<-table.row.end(a) > for (j in 1:length(fit$loadings[,1])) { + a<-table.row.start(a) + a<-table.element(a,rownames(fit$loadings)[j],header=TRUE) + for (i in 1:par1) { + a<-table.element(a,round(fit$loadings[j,i],3)) + } + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/2ty3f1445625067.tab") > > try(system("convert tmp/10fdn1445625067.ps tmp/10fdn1445625067.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.605 0.119 0.725