I've been using the pcaMethods to develop a scores matrix ======================================data(iris) pcIr <- pca(iris[,1:4], method="nipals", nPcs=3, cv="q2") test <- scores(pcIr) ======================================= What I'm looking to do is to use lattice's barchart to plot the scores something like below, but expanded to all the scores columns. Can someone give me a clue? I've thought about restructuring the data, but I'm not sure as to the best method to do this. (This is an example only....) ========================== barchart(test[,1],origin=0) ==========================Thank you kindly, -------------------------------------------------------------- Shawn Way, PE MECO, Inc. (p) 281-276-7612 (f) 281-313-0248 <img alt="" src="http://www.meco.com/img/meco.gif" /><br /> <a href="http://www.meco.com">WWW.MECO.COM</a><br /> This e-mail is for the use of the intended recipient(s) only. If you have received this e-mail in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not use, disclose or distribute this e-mail without the author's prior permission. We have taken precautions to minimize the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message. We cannot accept liability for any loss or damage caused by software viruses. [[alternative HTML version deleted]]
On 2010-07-19 7:35, Shawn Way wrote:> I've been using the pcaMethods to develop a scores matrix > > ======================================> data(iris) > pcIr<- pca(iris[,1:4], method="nipals", nPcs=3, cv="q2") > > test<- scores(pcIr) > =======================================> > What I'm looking to do is to use lattice's barchart to plot the scores > something like below, but expanded to all the scores columns. Can someone > give me a clue? I've thought about restructuring the data, but I'm not > sure as to the best method to do this. (This is an example only....) > > ==========================> barchart(test[,1],origin=0) > ==========================Here are a couple of ways: #1 barchart(test, origin = 0, stack = FALSE) #2 testdf <- stack(as.data.frame(test)) names(testdf) <- c("Scores", "PC") testdf$idx <- gl(150, 1) barchart(Scores ~ idx | PC, origin = 0, data = testdf, layout=c(1,3)) You might find dotplot(test) useful, as well. -Peter Ehlers> Thank you kindly, > > -------------------------------------------------------------- > Shawn Way, PE > MECO, Inc. > (p) 281-276-7612 > (f) 281-313-0248 >