0

I am trying to make 2 Screeplots. 1. A Screeplot that shows the variance of each PC 2. A plot that shows the relation of each variable with PCx

I used vegan to get my PCA:

LUI.C.V.PCA <- rda(LUI.C.V, scale=TRUE)

I tried this one from a vegan guide and replaced the x (2x) with my LUI.C.V.PCA:

screeplot(LUI.C.V.PCA, bstick = FALSE, type = c("barplot", "lines"), npcs = min(10, if (is.null(x$CCA)) x$CA$rank else x$CCA$rank), ptype = "o", bst.col = "red", bst.lty = "solid", xlab = "Component", ylab = "Inertia", main = deparse(substitute(LUI.C.V.PCA)))

error: object 'x' not found

Does anyone know what I did wrong or how I can do this easily? Thanks!

Els
  • 1
  • 1
  • It's easier to help you if you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data so we can run the code. You say you replaced the `x` but I still see a few in your `screeplot` command like `x$CCA`. Have you just copied over the signature? You should only set the parameters you want to change from the default values. – MrFlick Jul 25 '17 at 15:28
  • Thanks, when removing some things without x it works. The basic screeplot, however, shows the eigenvalues vs PCs, whereas I would like to show the % of variance vs PCs. Is there a way to do this within this function or do I need to look for another function? I found the `fviz_eig(x) function but this one does not work for rda data. – Els Jul 25 '17 at 15:56

0 Answers0