Error in eval: object 'mydata' not found

48 views
Skip to first unread message

Merel Postema

unread,
May 4, 2023, 8:14:42 AM5/4/23
to Shiny - Web Framework for R
Dear all,
Hope you can help me fix the following error:
Error in eval: object 'mydata' not found

Before building the webpage and running the server function, I define 'mydata':
mydata=read.csv('mydata.csv',sep='\t')

However, somehow this error occurs. I think it is related to the fact that, within the server function of Rshiny, I am trying to predict a model (mymodel) that was fitted with mydata, as below. Perhaps mydata should be explicitly defined within the server function..?

server <- function(input, output, session) {
    output$plot <- renderPlot(
        width=600,
        height =400,
        {
        ## some irrelevant code I left out ## 
          pred <- predictAll(mymodel, newdata=newdata) 
         ## plotting based on pred ##
           })

Thanks very much for your help!
Best,
Merel

Merel Postema

unread,
May 19, 2023, 3:42:25 AM5/19/23
to Shiny - Web Framework for R
Update: I have added a 'data' folder, such that mydata=read.csv('data/mydata.csv'), and I have added this code within the server function as well.
Yet I still get the error 'mydata not found'. Notably: it works fine when I run it in my console! However, when I clear Renviroment and then runApp(), the error occurs.
Hope someone can help me out with this!
Reply all
Reply to author
Forward
0 new messages