I can compile the following
EXEC sp_execute_external_script @language =N'R',
@script=N'
x <- c(1,2,3,4,5)
y <- c("a","b","c","d","e")
df <- data.frame(x,y)
OutputDataSet = df
'
However when I try to import data from csv as below,
@script=N'
df <- read.csv("C:\\Users\\LENOVO\\Desktop\\data\\loan.csv")
OutputDataSet = df
'
WITH RESULT SETS ((
id INT
,loan_amnt INT
))
I get this error:
A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
Msg 39019, Level 16, State 2, Line 47
An external script error occurred:
Error in file(file, "rt") : cannot open the connection
Calls: source ... withVisible -> eval -> eval -> read.csv -> read.table -> file
In addition: Warning message:
In file(file, "rt") :
cannot open file 'C:\Users\LENOVO\Desktop\data\loan.csv': Permission denied
Error in execution. Check the output for more information.
Error in eval(ei, envir) :
Error in execution. Check the output for more information.
Calls: runScriptFile -> source -> withVisible -> eval -> eval -> .Call
Execution halted
I tried to solve it, but no solution worked yet. What is the cause of the problem?
User contributions licensed under CC BY-SA 3.0