R in U-SQL in azure data lake analytics
I have been experimenting for a while now with R in Azure Data Lake Analytics and I keep getting stuck on installaing extra R-packages like dlplyr and tidyr. I asked the following question, but that did not solve the issue: Installing R-packages in Azure Data Lake Analytics
Now I am trying to follow this tutorial https://blog.revolutionanalytics.com/2017/10/adla-with-r.html but get an error when executing the third script usqlscriptEx3a.usql (https://github.com/Azure/ADLAwithR-GettingStarted/tree/master/Tutorial/Exercise3). I am using te script as is and I have been debugging the R-code locally, and that seems to do the right thing, so now I do not know where to look. The error is:
An unhandled exception from user code has been reported when invoking the method 'Reduce' on the user type 'Extension.R.Reducer'
Unhandled exception from user code: "Output column 'Par' is missing from the data frame"
However Par seems to be there as it should be.
Here follows some of the code from usqlscriptEx3a.usql:
REFERENCE ASSEMBLY [ExtR];
//declare the R script as a string variable and pass it as a parameter to
the Reducer:
DECLARE @myRScript = @"
temp = inputFromUSQL
t1 = loadedNamespaces()
temp = data.frame(loadedNamespaces = t1)
t2 = data.frame(apply(temp[1],1,FUN=function(x)
paste(unlist(packageVersion(as.character(x))),collapse='.')) )
names(t2) = 'packageVersion'
temp$packageVersion = t2$packageVersion
t3 = sessionInfo()[1]
t3 = t3$R.version$version.string
t3 = as.character(t3)
temp$Rversion = t3
temp$Rversion[2:nrow(temp)]=''
outputToUSQL = temp
";
DECLARE @myOutputFile string = @"/TutorialMaterial/outex3a.txt";
@somedata =
SELECT * FROM
(VALUES
("Contoso", 1500.0),
("Woodgrove", 2700.0)
) AS
D( customer, amount );
@ExtendedData = SELECT
0 AS Par,
*
FROM @somedata;
@RScriptOutput = REDUCE @ExtendedData ON Par PRODUCE
Par,
loadedNamespaces string,
packageVersion string,
Rversion string
USING new Extension.R.Reducer(command:@myRScript, rReturnType:"dataframe");
r
add a comment |
I have been experimenting for a while now with R in Azure Data Lake Analytics and I keep getting stuck on installaing extra R-packages like dlplyr and tidyr. I asked the following question, but that did not solve the issue: Installing R-packages in Azure Data Lake Analytics
Now I am trying to follow this tutorial https://blog.revolutionanalytics.com/2017/10/adla-with-r.html but get an error when executing the third script usqlscriptEx3a.usql (https://github.com/Azure/ADLAwithR-GettingStarted/tree/master/Tutorial/Exercise3). I am using te script as is and I have been debugging the R-code locally, and that seems to do the right thing, so now I do not know where to look. The error is:
An unhandled exception from user code has been reported when invoking the method 'Reduce' on the user type 'Extension.R.Reducer'
Unhandled exception from user code: "Output column 'Par' is missing from the data frame"
However Par seems to be there as it should be.
Here follows some of the code from usqlscriptEx3a.usql:
REFERENCE ASSEMBLY [ExtR];
//declare the R script as a string variable and pass it as a parameter to
the Reducer:
DECLARE @myRScript = @"
temp = inputFromUSQL
t1 = loadedNamespaces()
temp = data.frame(loadedNamespaces = t1)
t2 = data.frame(apply(temp[1],1,FUN=function(x)
paste(unlist(packageVersion(as.character(x))),collapse='.')) )
names(t2) = 'packageVersion'
temp$packageVersion = t2$packageVersion
t3 = sessionInfo()[1]
t3 = t3$R.version$version.string
t3 = as.character(t3)
temp$Rversion = t3
temp$Rversion[2:nrow(temp)]=''
outputToUSQL = temp
";
DECLARE @myOutputFile string = @"/TutorialMaterial/outex3a.txt";
@somedata =
SELECT * FROM
(VALUES
("Contoso", 1500.0),
("Woodgrove", 2700.0)
) AS
D( customer, amount );
@ExtendedData = SELECT
0 AS Par,
*
FROM @somedata;
@RScriptOutput = REDUCE @ExtendedData ON Par PRODUCE
Par,
loadedNamespaces string,
packageVersion string,
Rversion string
USING new Extension.R.Reducer(command:@myRScript, rReturnType:"dataframe");
r
add a comment |
I have been experimenting for a while now with R in Azure Data Lake Analytics and I keep getting stuck on installaing extra R-packages like dlplyr and tidyr. I asked the following question, but that did not solve the issue: Installing R-packages in Azure Data Lake Analytics
Now I am trying to follow this tutorial https://blog.revolutionanalytics.com/2017/10/adla-with-r.html but get an error when executing the third script usqlscriptEx3a.usql (https://github.com/Azure/ADLAwithR-GettingStarted/tree/master/Tutorial/Exercise3). I am using te script as is and I have been debugging the R-code locally, and that seems to do the right thing, so now I do not know where to look. The error is:
An unhandled exception from user code has been reported when invoking the method 'Reduce' on the user type 'Extension.R.Reducer'
Unhandled exception from user code: "Output column 'Par' is missing from the data frame"
However Par seems to be there as it should be.
Here follows some of the code from usqlscriptEx3a.usql:
REFERENCE ASSEMBLY [ExtR];
//declare the R script as a string variable and pass it as a parameter to
the Reducer:
DECLARE @myRScript = @"
temp = inputFromUSQL
t1 = loadedNamespaces()
temp = data.frame(loadedNamespaces = t1)
t2 = data.frame(apply(temp[1],1,FUN=function(x)
paste(unlist(packageVersion(as.character(x))),collapse='.')) )
names(t2) = 'packageVersion'
temp$packageVersion = t2$packageVersion
t3 = sessionInfo()[1]
t3 = t3$R.version$version.string
t3 = as.character(t3)
temp$Rversion = t3
temp$Rversion[2:nrow(temp)]=''
outputToUSQL = temp
";
DECLARE @myOutputFile string = @"/TutorialMaterial/outex3a.txt";
@somedata =
SELECT * FROM
(VALUES
("Contoso", 1500.0),
("Woodgrove", 2700.0)
) AS
D( customer, amount );
@ExtendedData = SELECT
0 AS Par,
*
FROM @somedata;
@RScriptOutput = REDUCE @ExtendedData ON Par PRODUCE
Par,
loadedNamespaces string,
packageVersion string,
Rversion string
USING new Extension.R.Reducer(command:@myRScript, rReturnType:"dataframe");
r
I have been experimenting for a while now with R in Azure Data Lake Analytics and I keep getting stuck on installaing extra R-packages like dlplyr and tidyr. I asked the following question, but that did not solve the issue: Installing R-packages in Azure Data Lake Analytics
Now I am trying to follow this tutorial https://blog.revolutionanalytics.com/2017/10/adla-with-r.html but get an error when executing the third script usqlscriptEx3a.usql (https://github.com/Azure/ADLAwithR-GettingStarted/tree/master/Tutorial/Exercise3). I am using te script as is and I have been debugging the R-code locally, and that seems to do the right thing, so now I do not know where to look. The error is:
An unhandled exception from user code has been reported when invoking the method 'Reduce' on the user type 'Extension.R.Reducer'
Unhandled exception from user code: "Output column 'Par' is missing from the data frame"
However Par seems to be there as it should be.
Here follows some of the code from usqlscriptEx3a.usql:
REFERENCE ASSEMBLY [ExtR];
//declare the R script as a string variable and pass it as a parameter to
the Reducer:
DECLARE @myRScript = @"
temp = inputFromUSQL
t1 = loadedNamespaces()
temp = data.frame(loadedNamespaces = t1)
t2 = data.frame(apply(temp[1],1,FUN=function(x)
paste(unlist(packageVersion(as.character(x))),collapse='.')) )
names(t2) = 'packageVersion'
temp$packageVersion = t2$packageVersion
t3 = sessionInfo()[1]
t3 = t3$R.version$version.string
t3 = as.character(t3)
temp$Rversion = t3
temp$Rversion[2:nrow(temp)]=''
outputToUSQL = temp
";
DECLARE @myOutputFile string = @"/TutorialMaterial/outex3a.txt";
@somedata =
SELECT * FROM
(VALUES
("Contoso", 1500.0),
("Woodgrove", 2700.0)
) AS
D( customer, amount );
@ExtendedData = SELECT
0 AS Par,
*
FROM @somedata;
@RScriptOutput = REDUCE @ExtendedData ON Par PRODUCE
Par,
loadedNamespaces string,
packageVersion string,
Rversion string
USING new Extension.R.Reducer(command:@myRScript, rReturnType:"dataframe");
r
r
asked Nov 13 '18 at 10:30
JonJagdJonJagd
83
83
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
It turns out, that what was missing, at least in my case, is the following line:
READONLY Par
In order to make the script usqlscriptEx3a.usql work I had to insert READONLY Par in the following lines:
@RScriptOutput = REDUCE @ExtendedData ON Par
PRODUCE Par,
loadedNamespaces string,
packageVersion string,
Rversion string
READONLY Par
USING new Extension.R.Reducer(command:@myRScript, rReturnType:"dataframe");
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278982%2fr-in-u-sql-in-azure-data-lake-analytics%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It turns out, that what was missing, at least in my case, is the following line:
READONLY Par
In order to make the script usqlscriptEx3a.usql work I had to insert READONLY Par in the following lines:
@RScriptOutput = REDUCE @ExtendedData ON Par
PRODUCE Par,
loadedNamespaces string,
packageVersion string,
Rversion string
READONLY Par
USING new Extension.R.Reducer(command:@myRScript, rReturnType:"dataframe");
add a comment |
It turns out, that what was missing, at least in my case, is the following line:
READONLY Par
In order to make the script usqlscriptEx3a.usql work I had to insert READONLY Par in the following lines:
@RScriptOutput = REDUCE @ExtendedData ON Par
PRODUCE Par,
loadedNamespaces string,
packageVersion string,
Rversion string
READONLY Par
USING new Extension.R.Reducer(command:@myRScript, rReturnType:"dataframe");
add a comment |
It turns out, that what was missing, at least in my case, is the following line:
READONLY Par
In order to make the script usqlscriptEx3a.usql work I had to insert READONLY Par in the following lines:
@RScriptOutput = REDUCE @ExtendedData ON Par
PRODUCE Par,
loadedNamespaces string,
packageVersion string,
Rversion string
READONLY Par
USING new Extension.R.Reducer(command:@myRScript, rReturnType:"dataframe");
It turns out, that what was missing, at least in my case, is the following line:
READONLY Par
In order to make the script usqlscriptEx3a.usql work I had to insert READONLY Par in the following lines:
@RScriptOutput = REDUCE @ExtendedData ON Par
PRODUCE Par,
loadedNamespaces string,
packageVersion string,
Rversion string
READONLY Par
USING new Extension.R.Reducer(command:@myRScript, rReturnType:"dataframe");
answered Nov 13 '18 at 13:23
JonJagdJonJagd
83
83
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278982%2fr-in-u-sql-in-azure-data-lake-analytics%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown