首页 > 解决方案 > r闪亮的ggplot在使用R.net的WPF C#中不起作用

问题描述

我尝试在 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,2,3,4))

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


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

标签: c#rggplot2shinyr.net

解决方案


推荐阅读