Amit Patel <amitrh...@yahoo.co.uk> writes: >>plot(BHPLS1, "loadings", comps = 1:2, legendpos = "topleft", labels = >>"numbers", >>xlab = "nm") > > Error in loadingplot.default(x, ...) : > Could not convert variable names to numbers. > > > str(BHPLS1_Loadings) > loadings [1:8892, 1:60] -0.00717 0.00414 0.02611 0.00468 -0.00676 ... > - attr(*, "dimnames")=List of 2 > ..$ : chr [1:8892] "PCIList1" "PCIList2" "PCIList3" "PCIList4" ... > ..$ : chr [1:60] "Comp 1" "Comp 2" "Comp 3" "Comp 4" ... > - attr(*, "explvar")= Named num [1:60] 2.67 4.14 4.41 3.55 2.59 ... > ..- attr(*, "names")= chr [1:60] "Comp 1" "Comp 2" "Comp 3" "Comp 4" ... > > Can anyone see the problem??
By using `labels = "numbers"', you are asking the plot function to convert the names "PCIList1" "PCIList2" "PCIList3" "PCIList4" ... to numbers. It doesn't know how to do that. (See ?loadingplot for the details.) Your options are using `label = "names"', provide your own labels, not using the `labels' argument, or converting the names manually. -- Bjørn-Helge Mevik ______________________________________________ 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.