If I try your code, it is like loading an image. However, when it opens using the Windows image viewer, it also says that it is damaged. The reason for this is because you did not specify modein the instructions download.file.
:
download.file(y,'y.jpg', mode = 'wb')
. ?download.file
, , , .
R,
jj <- readJPEG("y.jpg",native=TRUE)
plot(0:1,0:1,type="n",ann=FALSE,axes=FALSE)
rasterImage(jj,0,0,1,1)
.jpeg R 2.15
R 3.1.0