Forum Discussion
R script "Token Comma expected"
- 5 years ago
Hi SPaine86
The URL needs two sets of double quotes to escape it within the string it is inside i.e. ""url""
Try this
R.Execute("# 'dataset' holds the input data for this script#(lf)require(gdata)#(lf)write.table(trim(dataset), file=""https://site.sharepoint.com/site/AnalysisTeam/Automated Reporting/VA data.csv"", sep = ",", row.names=FALSE)#(lf)plot(dataset);",[dataset=#"Removed Columns"])regards
Phil
- 5 years ago
Hi SPaine86
The R doco doesn't mention writing to a web location so the solution looks to be to write to a local file and then copy the file up to the web.
As you are using Sharepoint, can you just write locally and let the file sync to Sharepoint?
Alternatively check these articles that address the issue.
Solved: Exporting file to sharepoint using R script editor - Microsoft Power BI Community
Saving files to SharePoint folder from R - Stack Overflow
Saving a file to Sharepoint with R - Stack Overflow
Regards
Phil
- 5 years ago
Hi SPaine86 ,
Apologies for jumping in here.
You can easily set-up scheduled exports from Power BI, everytime the data refreshes using a personal gateway which is very easy to set-up. Refer following blog if this helps:
Thanks,
Pragati
Hi SPaine86 ,
I think the problem is in the following line. Not sure why there is a SEMI COLON after plot(dataset):
plot(dataset);",[dataset=#"Removed Columns"])
Thanks,
Pragati
Thanks for your reply Pragati.
The error seems to be with my URL/path. From after file=" the formula turns one colour. This is also where Power BI indicates that the comma should be. I have tried different paths including pointing to my own desktop, and these all have the same 'token comma' error.
It may also be that the semi-colon also shouldn't be there, but the formula fails before it reaches that part - so I guess I'll find out once the path error is fixed!