I am trying to obtain correlation networks as a dataframe from my data so that I can manually later create networks on the top 25 highest correlated variables.
Here is my code:
> MyResult.spls <- spls(gene, taxa,
> #keepX=keepX, # I want all genes (5341 genes)
> #keepY=keepY, # I want all taxa (842 genera)
> scale=TRUE,
> ncomp=2,
> mode="regression",
> near.zero.var=FALSE)
>
> network_dataframe <- as.data.frame(network(MyResult.spls,comp = 1:2)$M)
>
> write.csv(network_dataframe,"stage1.csv"))
When trying to run network_dataframe, it takes FOREVER because R is also trying to create the graphic for this, is there a way to do this so that it just makes the table without trying to plot the network graphic? Sometimes it takes so long R just crashes saying there are errors but I know there are no errors, because I can run this code no problem with two other similar datasets that just happen to be smaller (same number of taxa, but about 4500 genes, so not a huge difference).
Any ideas on how to obtain the full correlation matrix without running into this time issue?