答案 0 :(得分:2)
R不需要安装。您可以在本地安装它,并通过ftp将文件夹复制到Azure函数。
我在C#中使用R.Net来运行R。
public static class Function1
{
[FunctionName("Function1")]
public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, ExecutionContext context, TraceWriter log)
{
REngine.SetEnvironmentVariables(System.IO.Path.Combine(context.FunctionDirectory, @"R-3.4.4\bin\x64"), System.IO.Path.Combine(context.FunctionDirectory, @"R-3.4.4"));
REngine engine = REngine.GetInstance();
string[] a = engine.Evaluate("'Hi there .NET, from the R engine'").AsCharacter().ToArray();
engine.Dispose();
return req.CreateResponse(HttpStatusCode.OK, a[0]);
}
}