Off topic:Simple topic - Why this script is not working
0
0
Entering edit mode
6.9 years ago
lessismore ★ 1.3k

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 • 974 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2329 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6