Lign251 FAQ
From Rlang
How do I print plots to file?
Read Section 12.6 of the [Introduction to R] manual. Specifically, you'll be interested in the jpeg(), postscript(), and dev.off() commands. Also see the solution to problem 3 in [Homework 1].
How do I read the Homework 2 data file?
Sorry, I should have given you this info in advance. You use read.table() to read the file into a data frame, but you need to tell read.table() to treat the character ' literally instead of as a special quote character. Here's the code to read the data file:
Hints on Homework 3, problem 2
Writing the code for this assignment may be easier using a for() loop. Here's an example:
possible.N <- seq(2,100,by=2)
mean.by.N <- NULL
for(N in possible.N) {
mean.for.this.N <- ###insert your code here###
mean.by.N <- c(mean.by.N,mean.for.this.N)
}
# now plot mean.by.N against possible.N
For more about for() loops in R, read [Section 9.2.2] of the [Introduction to R] manual.
