Question: (Closed) Simple topic - Why this script is not working
0
gravatar for lessismore
3.6 years ago by
lessismore930
Mexico
lessismore930 wrote:

can anybody correct this script? 1) i cannot paste here the entire script line by line and i had to separate the commands by semicolumns 2) the script diplays the output NULL and i dont understand why 3) sorry im a complete dummy ad i found this script on a journal

#!/usr/bin/env Rscript; 
outputfile <- paste ("linear", ".png", sep=""); 
png(filename=outputfile, width=1600, height=1200); 
x <- c(0,1,2,3,4,5,6,7,8,9,10); y <- c(2,5,6,7,8,10,11,20,14,25,30); 
p <- plot(x,y,pch=19); #First degree equation 
fit <- lm(y~x) 
print(p); 
lines(x,predict(fit,data.frame(x=x)),col="red"); 
invisible(dev.off())
R • 746 views
ADD COMMENTlink modified 3.6 years ago by WouterDeCoster44k • written 3.6 years ago by lessismore930

Hello lessismore!

We believe that this post does not fit the main topic of this site.

This doesn't look like a bioinformatics question, but a beginner R question. Teaching R basics is nothing this format is good at.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

ADD REPLYlink written 3.6 years ago by Michael Dondrup48k

I adapted your post, in your printing of the code. This script should create a file in the current directory so perhaps it works after all.

ADD REPLYlink written 3.6 years ago by WouterDeCoster44k

I understand, Thanks a lot for the adaptation and the answer.

ADD REPLYlink written 3.6 years ago by lessismore930
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1319 users visited in the last hour