args = commandArgs(trailingOnly=TRUE)

df = read.csv(args[1],header=TRUE, stringsAsFactors=FALSE)

head(df)
cat("...","\n")
tail(df)

cat("\n")
summary(df)

cat("\n","Saving the original figure...","\n")
png("r_orig.png")
plot(df$x, df$y)
dev.off()

relation <- lm(df$y~df$x)

relation

cat("Saving the linear modeling figure...","\n")
png("r_lm.png")
plot(df$x,df$y)
abline(relation)
dev.off()