Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install PhantomJS in R Studio?

Tags:

r

phantomjs

I wrote a program that needs to run, the following is my R code:

library(webshot)

webshot("tmp.html","Normal_top100.png", delay =10, vwidth = 1920, vheight=1080) 

However, I got the following message:

PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.

Therefore, I need to install Phantomjs, but I got some problem cannot be solved.

I saw the following link to install it, but I don't know why I still cannot run successfully.

https://www.jianshu.com/p/a7fd378714eb

The website said that you need to set Environment Variable and I used the method of this link. However, when I run this code again, I still got the same error. I suspected the reason is this website is incorrect.

Can anyone help me? Thanks.

like image 487
Jiun Jung Lin Avatar asked Nov 15 '22 08:11

Jiun Jung Lin


1 Answers

For installing phantomJS you just need to run the following command in the R console:

webshot::install_phantomjs()

It will be downloaded and installed into your default library directory.

For more details please read the documentation: https://rdrr.io/cran/webshot/man/install_phantomjs.html

like image 66
The Doctor Avatar answered Dec 30 '22 23:12

The Doctor