This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Simple topic - Why this script is not working

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

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!

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.

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

0 answers

No answers yet.

Log in to answer this question.