I am trying to do a scree plot with my data but R keeps telling me:
Error in plot.window(...) : need finite 'ylim' values
My code is:
screeplot(res.comp, npcs = 24, type = "lines")
and R says:
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
I do not know what this means or how to correct it. I have tried looking around to fix the problem and came up with the solution:
PCA.output <- res.comp
res.comp <- function(xlim, ylim, log="", asp=NA, ...) {
+ if (!all(is.finite(xlim))) xlim <- c(0,1)
+ if (!all(is.finite(ylim))) ylim <- c(0,1)
+ PCA.output(xlim, ylim, log="", asp=NA, ...)}
screeplot(PCA.output, npcs = 24, type = "lines")
But R gave me the same answer:
Error in plot.window(...) : need finite 'ylim' values
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
Could anyone help me understand what's going on? Thank you in advance! Bellow is the data I am trying to scree plot.
Active Aggressive to people Anxious Calm Cooperative Curious Depressed Eccentric Excitable
[1,] 6 2.577787 2.097215 4.743244 7 7 1 1 5
[2,] 6 4.000000 4.000000 5.000000 6 2 3 3 2
[3,] 5 2.034049 1.744754 5.249933 7 7 1 1 5
Fearful of people friendly of people Insecure Playful Self assured Smart Solitary Tense Timid
[1,] 1 5 2 4 7 6 4 1 2
[2,] 2 6 5 6 6 2 4 2 2
[3,] 1 7 2 2 7 7 3 1 2
Trusting Vigilant Vocal
[1,] 6 7 2
[2,] 6 6 7
[3,] 6 5 1