ggbiplot worked previously with prcomp, now will not

1.4k Views Asked by At

ggbiplot used to work with no problems using prcomp but now does not. All I receive is the following error code:

Error in plot_label(p = p, data = plot.data, label = label, label.label = label.label, : Unsupported class: prcomp

I have installed ggbiplot using dependencies=TRUE and everything else other posts about similar issues have done but yet I still get this message.

Any help is appreciated.

mypca <- prcomp(mydata, center=TRUE, scale.=TRUE)
ggbiplot(mypca, center=TRUE, scale.=TRUE)

Error in plot_label(p = p, data = plot.data, label = label, label.label = label.label, : Unsupported class: prcomp

2

There are 2 best solutions below

0
On

I don't think ggbiplot has a center nor scale. argument. Are you confusing prcomp with ggbiplot function arguments?

The following works just fine:

library(ggbiplot)
pca <- prcomp(USArrests, center = TRUE, scale. = TRUE)
ggbiplot(pca)

enter image description here

Tested on ggbiplot_0.55.

0
On

Try,

ggbiplot::ggbiplot(mypca)