Solution to the PCA exercise

pc = prcomp(quas[,-1])
prcomp does not compute the projections for us. So we need to carry out the matrix multiplication to find them ourselves.
There are a couple of points in order here. First, both the arguments in a matrix multiplication (%*%) must be matrices (or vectors). Here quas[,-1] is a dataframe, which needs to be converted to a matrix using the as.matrix function. Also, we are computing the projections along the first two principal componnt only. Hence we are using pc$rot[,1:2].

Now it is just a matter of plotting.
The scale would be somewhat different here than for princomp, however the absolute scale is of no importance here. It's the directions and the relative scatter along them that matter.