1

I have a stange error in renderPlot section. Here is the example (extract from the main script):

ui.R

 splitLayout(cellWidths = 600, plotOutput("box_plot_best", width = "80%", height = "200px"))

server.r

output$box_plot_best <- renderPlot({

          boxplot(c(1:100), width=4, horizontal= TRUE, staplewex = 1, axes=FALSE, main=("Theoretical boxplot"))     
          abline(v = mean(c(1:100)), col = "red") 
          dev.off()

        })

Earlier everything was ok - the boxplot was generated. but now a strange error is generated:

Error in gregexpr(calltext, singleline, fixed = TRUE) :
regular expression is invalid UTF-8
Browse[2]> c
Warning: Error in grDevices::recordPlot: no current device to record from
Stack trace (innermost first):
89:
78: plotObj
77: origRenderFunc
76: output$box_plot_abs
1: runApp
Called from: eval(expr, envir, enclos)
Error in gregexpr(calltext, singleline, fixed = TRUE) :
regular expression is invalid UTF-8

I have found a similar error and solution but not exectly my case I would be gratefull for your hints.

Community
  • 1
  • 1
Dimon D.
  • 438
  • 5
  • 23

1 Answers1

3

It appears that the issue is with the dev.off() line. Once you remove that it works.

Xiongbing Jin
  • 11,779
  • 3
  • 47
  • 41