#data must be numeric, avoid using categorical and characters
data(UScereal, package="MASS")
variables=c("calories","protein","sodium","carbo","sugars","potassium")
data=UScereal[variables]
#create object with observation number starting with nothing.
mod1 <- qrfactor(data)
#print object
mod1
#extract the loadings
loadings=mod1$loadings
#summary of the loadings
summary(mod1)
#plot the first two axes of the loadings
plot(mod1)
#2nd model with observations or records starting from zero and standardising
mod2<-qrfactor(data,obs_start=0,mod_type='sd')
#print object 2
mod2
#extract the loadings
loadings=mod2$loadings
#summary of the loadings
summary(mod2)
#plot the the first two axes of the loadings
plot(mod2)
#plotting other axes for mod2 for axes 3 and 4
plot(mod2$loadings[,3],mod2$loadings[,4])
Run the code above in your browser using DataLab