Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have this R script and he run succefully but when i would to load in Power BI, i get that error message:
this is my code:
library(rvest)
> library(httr)
> sess <- html_session("http://www.atb.com.tn/", user_agent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.39 Safari/537.36"))
> pg <- jump_to(sess, "http://www.atb.com.tn/devise")
> dat <- content(pg$response, as="parsed")
> mydata= html_table(html_nodes(dat, "table")[[2]], header=TRUE)
And that the error message:
Détails : « ADO.NET : Erreur du script R.
Le chargement a nÚcessitÚ le package : xml2
Error in as.vector(x, "list") :
cannot coerce type 'environment' to vector of type 'list'
Calls: html_table ... <Anonymous> -> lapply -> as.list -> as.list.default
ExÚcution arrÛtÚe
Adding library(methods) reference has worked. Since data frame returned has duplicate column names it would again error out so changed header to False (it will return header as first row and you can again change that to headers in power bi) and also fill = True. so end script which works will be as follows,
library(rvest)
library(methods)
library(httr)
sess <- html_session("http://www.atb.com.tn/", user_agent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.39 Safari/537.36"))
pg <- jump_to(sess, "http://www.atb.com.tn/devise")
dat <- content(pg$response, as="parsed")
mydata= html_table(html_nodes(dat, "table")[[2]], header=FALSE, fill=TRUE)
Many thanks
Hi,
Any news about this issue, as I have the same error message:
Details: "ADO.NET: R script error.
Loading required package: xml2
Warning message:
'html' is deprecated.
Use 'read_html' instead.
See help("Deprecated")
Error in as.vector(x, "list") :
cannot coerce type 'environment' to vector of type 'list'
Calls: %>% ... <Anonymous> -> lapply -> as.list -> as.list.default
Execution halted
"
The installation folder is:
C:\Program Files\R\R-3.3.1
The downloaded binary packages (add-on packages) are in:
C:\Users\dev\AppData\Local\Temp\RtmpCYKMBC\downloaded_packages
The '.libPaths()' will give the following paths:
[1] "C:/Users/dev/Documents/R/win-library/3.3"
[2] "C:/Program Files/R/R-3.3.1/library"
As during installing add-on, I have chosen to have a personal library:
Would you like to use a personal library instead? Yes
BR
Isn't there any reply to his post?
@beno I'm not very familiar with "R", other than people like to make pirate jokes when studying and applying it. I did find this forum with a similiar question, it sounds like it could assist you.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 63 | |
| 18 | |
| 12 | |
| 11 | |
| 10 |