R and graphs for exercise 1