Load image from website

前端 未结 3 1194
谎友^
谎友^ 2020-12-12 03:10

I am trying to add some chemical structure images to some plots I have created. I am using the ACToR database to access the chemical structures. For example:

3条回答
  •  隐瞒了意图╮
    2020-12-12 03:20

    (Just posting my comment as an answer)

    You can use the download.file function to download files from the web.

    In addition, Windows users may have to alter some of the arguments. It seems that mode="wb" is a necessary argument to download and view these png files correctly.

    So, something like:

    download.file("http://actor.epa.gov/actor/image?format=png%3Aw1000%2Ch1000&casr‌​‌​n=80-05-7", 
                  destfile="tmp.png", mode="wb")
    

    worked for me.

提交回复
热议问题