Forum Discussion
Error in file(filename, "r", encoding = encoding) : cannot open the connection Calls: source -> file
Hello,
I am trying to import an R script into power BI, I tested the script in R and it works perfectly fine but when I try to import it to power bi using "get data -> r script", this is the message I get:
Here is the script I try to load into R script in Power BI:
actualLibPaths <- as.data.frame(.libPaths(.libPaths()[3]))
source(here::here("subfolder1", "subfolder2", "subfolder3", "subfolder4", "subfolder5", "script.R"))
output <- script_last %>%
group_by(actual_month) %>%
summarise(location = "main",
total_all = sum(total)
) %>%
bind_rows(script_last) %>%
mutate(id = row_number())
It is not a big script and nothing too complicated. I ran it in R before loading into power bi and everything is working just fine in R, however, I am not sure why i am getting that message, everything is set up just fine in power bi:
if someone could please help, I would really appreciate that
EDIT:
I changed my script in r script editor in power bi to just this:
source("C:/Users/MyUserName/folder1/subfolder1/subfolder2/subfolder3/subforlder4/script.R")I tested it in R first and it works just fine but when I import to r script in power bi, this is the new message I get:
We encountered an error while trying to connect. Details: "SYMSXP"
I have no idea how to solve this, the error message is not very helpful, if someone could please help, I would appreciate that
4 Replies
- AnonymousNot applicable
HI Anonymous,
I'd like to suggest you double-check the current account and permission configurations to ensure if you and power bi desktop client have enough permissions to access initiation path/folder of R script.
Regards,
Xiaoxin Sheng
- AnonymousNot applicable
Anonymous thanks, is there a way I can check?
- AnonymousNot applicable
HI Anonymous,
Normally you can enter the parent folder of the configured path and right click on the folder and choose 'properties'. Then you can navigate the 'security' tab to check corresponded permission setting of different users.
How to Set File and Folder Permissions in Windows (online-tech-tips.com)
Regards,
Xiaoxin Sheng