Closed EarlGlynn closed 4 years ago
Does this code run for you?
files <- c(
"https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Iris_setosa.JPG/180px-Iris_setosa.JPG",
"https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Iris_virginica_-_NRCS.jpg/320px-Iris_virginica_-_NRCS.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/2/27/20140427Iris_versicolor1.jpg/320px-20140427Iris_versicolor1.jpg"
)
imgs <- lapply(files, function(x) {
print(x)
RCurl::getBinaryURL(x)
})
#> [1] "https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Iris_setosa.JPG/180px-Iris_setosa.JPG"
#> [1] "https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Iris_virginica_-_NRCS.jpg/320px-Iris_virginica_-_NRCS.jpg"
#> [1] "https://upload.wikimedia.org/wikipedia/commons/thumb/2/27/20140427Iris_versicolor1.jpg/320px-20140427Iris_versicolor1.jpg"
Created on 2020-05-25 by the reprex package (v0.3.0)
I can confirm the observation of @EarlGlynn when running R 3.6.3 on Windows 10 x64 (build 17763).
Error in function (type, msg, asError = TRUE) :
error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
@clauswilke The code you posted produces the same error.
There's nothing I can do about this then. Looks like RCurl fails on Windows, maybe because the URL uses the https protocol. You could always work around the problem by downloading the images to your local drive and then using local file paths instead of URLs.
curl and RCurl historically have been a problem with Windows. But curl
works fine from a command line in Windows now -- but I'm not sure exactly what RCurl does and why it's failing.
curl https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Iris_setosa.JPG/180px-Iris_setosa.JPG -o x.jpg
The following gets the example to work in Windows using your files
from above to copy the files locally, and modifying the labels
from your example:
lapply(files, function(x) {download.file(x, basename(x), mode="wb")})
labels <- c(
setosa = "<img src='180px-Iris_setosa.JPG'
width='100' /><br>*I. setosa*",
virginica = "<img src='320px-Iris_virginica_-_NRCS.jpg'
width='100' /><br>*I. virginica*",
versicolor = "<img src='320px-20140427Iris_versicolor1.jpg'
width='100' /><br>*I. versicolor*"
Your ggplot
with element_markdown
works fine now on Windows and displays the iris images with species name in italics!
ggtext
will be quite useful.
The iris boxplot example from https://wilkelab.org/ggtext/ fails on Windows in the
ggplot
statement. Is this a known problem?Could you publish your sessionInfo() with your examples? Perhaps this is a Windows - Mac difference, since Windows can be a bit fickle with RCurl?
Here's my sessionInfo: