Quantcast
Channel: Power Query topics
Viewing all articles
Browse latest Browse all 31075

How to pass query parameter to Data Query (R integration)?

$
0
0

Is it possible to pass parameters to R data queries? For instance, my query is

 

let
    Quelle = R.Execute("NormalNoise <- data.frame(x=rnorm(100, mean=0, sd=1)"),
    EnvVars1 = Quelle{[Name="NormalNoise"]}[Value]
in
   EnvVars1

 

Now, is it possible to pass parameters to the string in R.Execute? For instance, I want to define a parameter NoiseMean and NoiseSd in the Query Window and use their value.

 

EDIT: I tried to use the "&" operator as I know it from VBA:

 

let
    Quelle = R.Execute("NormalNoise <- data.frame(x=rnorm(100, mean="&NoiseMean&", sd=1)"),
    EnvVars1 = Quelle{[Name="NormalNoise"]}[Value]
in
   EnvVars1

 

however, I get the error message that "&" can not applied to text and numbers


Viewing all articles
Browse latest Browse all 31075

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>