开发者

pasting Jpeg output in directory in R

开发者 https://www.devze.com 2023-04-01 14:03 出处:网络
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.

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 <- col开发者_StackOverflow中文版names(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],p‌​ch='.'
          ,text (maximum-2,minimum+0.5
          ,labels=paste("R = ",correlation,sep=""),pos=4,offset=0)) 
        dev.off() 
      } 
    } 
  }


In the line

jpeg(file=paste("/",IDs[i],"gegen",IDs[j],".jpg",sep="")) 

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 directory D:/output.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号