Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi
I need some help accessing a file from a sharepoint location and using it as a source/data in an R script.
While this is an R issue, it also relates to the workflow of importing from a file from sharepoint in power bi desktop. So I'll cross post in the both the R and desktop forum.
I want to use a file stored in sharepoint as the source for an R script.
The file is a specific format which is used by a set of R packages.
I have a taxonomy.rdf file stored on sharepoint.
I can access the file via the sharepoint connector
e.g.
let Source = SharePoint.Files("https://mysite.sharepoint.com/sites/MST_EPA_IntelligenceandAnalysisTeamSite", [ApiVersion = 15]), #"taxonomy.rdf_https://mysite.sharepoint.com/sites/MST_EPA_IntelligenceandAnalysisTeamSite/Shared Documents/" = Source{[Name="epa_taxonomy_EDG_working.rdf",#"Folder Path"="https://mysite.sharepoint.com/sites/MST_EPA_IntelligenceandAnalysisTeamSite/Shared Documents/"]}, Content = #"taxonomy.rdf_https://mysite.sharepoint.com/sites/MST_EPA_IntelligenceandAnalysisTeamSite/Shared Documents/"[Content] in Content
But how do I pass that file/query/source as a file object to an R script ?
The R script runs on the file, so I don't want to parse it.
I have a an R script which if I am using that file locally is ( see blue text for use of file path)
setwd("Y:/Data//2019/test") require(magrittr) require(rdflib) library(magrittr) library(rdflib) sparql <- 'PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?a ?p WHERE { ?a a ?p . }' out = "Y:/Data//2019/test/taxonomy.rdf" %>% rdf_parse() %>% rdf_query(sparql) write.csv(out, file="testpbRDF6.csv")
My R skills are pretty rough so I don't know if you can pass the a query to the R script ?
I've tried a few combinations of embedding the sharepoint path into the R script without success.
If anyone has a simpler example query and can share your're a legend !
cheers
Simon
Solved! Go to Solution.
HI @Anonymous ,
You can try to use R.exclude function to execute r script string or r script who stored in local file.
Running Local R Scripts in Power BI
If you publish pbix file to power bi service, some of script operations will been blocked due to security reasons.(e.g. access external data source, import/export from specific path...)
Creating R visuals in the Power BI service#r scripts security
BTW, power bi service not support custom r packages. You can refer to following link to know supported packages:
R packages in the Power BI service
Regards,
Xiaoxin Sheng
HI @Anonymous ,
You can try to use R.exclude function to execute r script string or r script who stored in local file.
Running Local R Scripts in Power BI
If you publish pbix file to power bi service, some of script operations will been blocked due to security reasons.(e.g. access external data source, import/export from specific path...)
Creating R visuals in the Power BI service#r scripts security
BTW, power bi service not support custom r packages. You can refer to following link to know supported packages:
R packages in the Power BI service
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
94 | |
77 | |
65 | |
53 |
User | Count |
---|---|
145 | |
105 | |
104 | |
90 | |
63 |