-1

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

Maurits Evers
  • 49,617
  • 4
  • 47
  • 68

2 Answers2

0

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.

Maurits Evers
  • 49,617
  • 4
  • 47
  • 68
0

Try,

ggbiplot::ggbiplot(mypca) 
xilliam
  • 2,074
  • 2
  • 15
  • 27
Sid
  • 1