I'm using R 4.1.2 in RStudio with corrplot 0.92. When I run the following:
general_df = data.frame(matrix(rnorm(20), nrow=10))
library(corrplot)
M <- cor (general_df)
corrplot(M, type = 'upper')
general_log <- cor (log (general_df))
corrplot (general_log, order = "hclust", addrect = 5,
method = 'ellipse', title = 'FPC: Log-Transform')
This returns the error:
Error in hclust(as.dist(1 - corr), method = hclust.method) :
NA/NaN/Inf in foreign function call (arg 10)
There are obviously no NA/NaN/Inf rows or columns in my data set. How do I fix this problem?
The log transform generates NaNs as some values of your input are negative.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.