prab4th
prab4th

Reputation: 241

plot(x) doesn't return a plot or any output or any error after rutting x <- hclust(y, "ave")

I'm trying to follow the instructions given in PDF to construct a co-expression network. One of the first steps is constructing a dendrogram. This is the code.

The link to LiverFemale3600.csv is here in a zipped file.

# Load the WGCNA package
library(WGCNA);

options(stringsAsFactors = FALSE);

#Read in the female liver data set
femData = read.csv("LiverFemale3600.csv");

datExpr0 = as.data.frame(t(femData[, -c(1:8)]));
names(datExpr0) = femData$substanceBXH;
rownames(datExpr0) = names(femData)[-c(1:8)];


sampleTree = hclust(dist(datExpr0), method = "average");

par(cex = 0.6);
par(mar = c(0,4,2,0))
plot(sampleTree, main = "Sample clustering to detect outliers", sub="", xlab="", cex.lab = 1.5, cex.axis = 1.5, cex.main = 2)

Here the plot() doesn't return anything in RStudio. The plot window is blank, but it doesn't return any error either.

When show(sampleTree) is run I got the following.

> show(sampleTree)

Call:
hclust(d = dist(datExpr0), method = "average")

Cluster method   : average 
Distance         : euclidean 
Number of objects: 135 

Upvotes: 0

Views: 203

Answers (1)

Jake
Jake

Reputation: 520

Run just the plot line if you want your plot to appear in RStudio's plotting frame. Otherwise running the par lines will open a separate plotting window, and the graph will not appear in your normal plotting frame in RStudio.

Upvotes: 1

Related Questions