Closed markziemann closed 2 years ago
possible solution from https://stackoverflow.com/questions/49034322/melt-correlation-matrix-in-r
correlate_melt <- melt(replace(correlate, lower.tri(correlate, TRUE), NA), na.rm = TRUE)
it works when correlate is subset to 10k x 10k so I suspect the code is okay but some limit is hit
> correlate_melt <- reshape2::melt(correlate2, na.rm = TRUE)
> correlate2 <- correlate[1:40000,1:40000]
> correlate_melt <- reshape2::melt(correlate2, na.rm = TRUE)
> correlate2 <- correlate[1:50000,1:50000]
> correlate_melt <- reshape2::melt(correlate2, na.rm = TRUE)
Error in if (n > 0) c(NA_integer_, -n) else integer() :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In rep.fac * nx : NAs produced by integer overflow
2: In .set_row_names(as.integer(prod(d))) :
NAs introduced by coercion to integer range
Low budget solution:
> correlate1 <- correlate[1:30000,]
> correlate2 <- correlate[30001:nrow(correlate),]
> correlate_melt1 <- reshape2::melt(correlate1, na.rm = TRUE)
> correlate_melt2 <- reshape2::melt(correlate2, na.rm = TRUE)
> correlate_melt <- rbind(correlate_melt1, correlate_melt2)
> remove(c(correlate_melt1,correlate_melt2))
This actually fixed it. I suspect that melting huge matrices like this requires integers greater than the max allowable.
This actually fixed it. I suspect that melting huge matrices like this requires integers greater than the max allowable.
I know the solution worked, but is there anyway we can split this into multiple matrices instead?
https://github.com/casbap/ncRNA/blob/c5533e06dd70bac608dba7eb0f75598098e0e0e4/HumanDataPrep.Rmd#L172
Getting an error with this line: