r 闪亮的 ggplot 无法在 WPF C# 中使用 R.net 工作

问题描述

我尝试在 C# WPF 中使用 Shiny(R),有按钮可以激活闪亮的应用程序

使用 C# R.net 我构建了闪亮的应用程序,我认为一切运行良好 ,但是当我绘制 ggplot 时出现 C# 错误 (System.StackOverflowException,HResult=0x800703E9)

此外,没有 ggplot ,它运行良好......但我想使用 ggplot

我找了好几天才找到解决方

请帮忙,先谢谢了

C# 代码

using RDotNet;

REngine.SetEnvironmentvariables();
REngine rEngine = REngine.GetInstance();
rEngine.Initialize()
rEngine.Evaluate("source('../../R/R_CODE/shiny/shiny_run.R')");

代码中的 R 闪亮代码('../../R/R_CODE/shiny/shiny_run.R')



library(ggplot2)
library(dplyr)
library(shiny)
library(shinydashboard)
##############

ui <- dashboardPage(
  dashboardHeader(),sidebar<-dashboardSidebar(  ),body<-dashboardBody( plotOutput("sample1") )
                      
)

server <- function(input,output,session) {
  session$onSessionEnded(function() {
    stopApp()
  })

  toy = data.frame(x=c(1,2,3,4),y=c(1,4))

  output$sample1 = renderPlot({ 
    ggplot(data=toy,aes(x,y))+geom_point()
    })
}


app=shinyApp(
  ui,server
)
runApp(app)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)