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
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.