将 Jpeg 输出粘贴到 R 的目录中
我有执行散点图的函数,我想将结果(Jpeg 图像)粘贴到 D:/output 中,但它粘贴到 D:/ 中。我希望将结果粘贴到 D:/output 中。 请帮助我。
setwd("D:/output")
IDs <- colnames(raw.expression)
for (i in 1:(dim(raw.expression)[2]-1))
{ for( j in i:(dim(raw.expression)[2]) )
{ if (i != j)
{ jpeg(file=paste("/",IDs[i],"gegen",IDs[j],".jpg",sep=""))
correlation <- round(cor(raw.expression[,i],raw.expression[,j]),2)
maximum <- max(log2(raw.expression[,i]))
minimum <- min(log2(raw.expression[,i]))
plot(log2(raw.expression[,i]),log2(raw.expression[,j])
,xlab=IDs[i],ylab=IDs[j],pch='.'
,text (maximum-2,minimum+0.5
,labels=paste("R = ",correlation,sep=""),pos=4,offset=0))
dev.off()
}
}
}
I have function which performs scatter plot and I want to paste the results(Jpeg images) in D:/output but instead it is pasting in D:/.I want my results to be pasted on D:/output.
Please do help me.
setwd("D:/output")
IDs <- colnames(raw.expression)
for (i in 1:(dim(raw.expression)[2]-1))
{ for( j in i:(dim(raw.expression)[2]) )
{ if (i != j)
{ jpeg(file=paste("/",IDs[i],"gegen",IDs[j],".jpg",sep=""))
correlation <- round(cor(raw.expression[,i],raw.expression[,j]),2)
maximum <- max(log2(raw.expression[,i]))
minimum <- min(log2(raw.expression[,i]))
plot(log2(raw.expression[,i]),log2(raw.expression[,j])
,xlab=IDs[i],ylab=IDs[j],pch='.'
,text (maximum-2,minimum+0.5
,labels=paste("R = ",correlation,sep=""),pos=4,offset=0))
dev.off()
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在该行中,
您在文件名前面加上“/”,这表明这是一个绝对路径,从文件结构的顶部开始。我猜测在 Windows 上,这将是当前驱动器号的顶部,因此它将进入 D:而不是当前工作目录 D:/output。
In the line
you prepend the filename with a "/" which would indicate that this is an absolute path, starting at the top of the file structure. I'm guessing on windows, this would be the top of the current drive letter, so it is going into
D:
rather than the current working directoryD:/output
.