У меня есть данные, что выглядит как this:Почему read.table дает ошибку соединения во время выполнения в функции
Probes Gene.symbol some.kk.06 some.sp.06 some.ln.06 some.kk.06 some.sp.06
1419083_at Tnfsf11 0 1.273 0.976 0 0.964
1419318_at Saa4 1.134 0 0 1.916 0
1442255_at --- 0 1.104 1.417 0 0.761
1421025_at Agpat1 0 1.058 0.976 0 1.02
1427071_at Fbxo42 1.094 1.012 1.137 1.589 1.308
То, что я хочу сделать, это построить в dendogram на код ниже:
#!/u21/neversaint/.r/bin/Rscript
library(gplots);
plot.hclust <- function(inputfile,clust.height) {
dat.some <- read.table(inputfile,na.strings=NA, sep="\t",header=TRUE);
print(head(dat.some))
rownames(dat.some) <- do.call(paste,c(dat.some[c("Probes","Gene.symbol")],sep=" "))
dat.some <- dat.some[,!names(dat.some) %in% c("Probes","Gene.symbol")]
dat.some <- dat.some
# Clustering and distance function
hclustfunc <- function(x) hclust(x, method="complete")
distfunc <- function(x) dist(x,method="maximum")
# Select based on FC, as long as any of them >= anylim
dat.some <- dat.some[ apply(dat.some, 1,function(x) any (x >= anylim)), ]
nrow(dat.some);
# Clustering functions
height <- clust.height;
# Define output file name
dendoout <- paste("some.pafc.dendo.",anylim,".h",height,".default.pdf",sep="");
# Compute distance and clusteirn function
d.some <- distfunc(dat.some)
fit.some <- hclustfunc(d.some)
str(fit.some)
# Plot the hierarchical dendogram without heatmap
pdf(file=dendoout,width=120,height=27);
plot(fit.some)
dev.off()
}
plot.hclust("http://pastebin.com/raw.php?i=i8XXxUu0",clust.height=3);
Но он выводит сообщение об ошибке:
Error in read.table(inputfile, na.strings = NA, sep = "\t", header = TRUE) :
'file' must be a character string or connection
Как я могу решить это?