How to directly read an image file from a url address in R
Just save the image as a temporary file:
myurl <- "http://upload.wikimedia.org/wikipedia/commons/9/95/Apollonian_spheres.jpg"
z <- tempfile()
download.file(myurl,z,mode="wb")
pic <- readJPEG(z)
file.remove(z) # cleanup
You do NOT have to save the image into the disk. You could directly read the image through the URL as well as below:
library(magick)
image_url <- "http://upload.wikimedia.org/wikipedia/commons/9/95/Apollonian_spheres.jpg"
pic <- image_read(image_url)
print(pic)