readRDS doesn't work before server.R

1,306 views
Skip to first unread message

Thomas Chauvet

unread,
Aug 6, 2014, 3:15:23 AM8/6/14
to shiny-...@googlegroups.com
Hello,

I try to load data before the file server.R. I use the command readRDS to read this data (file .rds). But the files are not load. I put the data into a subdirectory named data.

Here's the code of server.R (the begining) :
# server.R
library
(shiny)

noms  
<- readRDS("data\\noms.rds")
series
<- readRDS("data\\series.rds")

source
('c1_simple.R')
source
('c2_simple.R')
source
('c3_simple.R')
source
('cusum_bn.R')
source
('watkins.R')
source
('fonctions_test.R')


shinyServer
(function(input, output) {

  serie_selectionnee
<- reactive({
    series
[[input$nom.serie]]
 
})

etc
...

Thanks for the help !



Fereshteh Karimeddini

unread,
Aug 8, 2014, 1:19:04 PM8/8/14
to shiny-...@googlegroups.com
Are you running on Windows? This format:

"data\\noms.rds"

should work on Windows, but it won't work on Mac and Linux. Try using the following if not on Windows:

"data/noms.rds"

Best,
Fereshteh

Thomas Chauvet

unread,
Aug 11, 2014, 5:09:47 AM8/11/14
to shiny-...@googlegroups.com
Yes, I'm running on Windows. That's why I don't understand the problem.

I also try the function load() to load a .RData but it doesn't work...

Thanks for your help !

Fereshteh Karimeddini

unread,
Aug 11, 2014, 12:08:02 PM8/11/14
to shiny-...@googlegroups.com
Thomas,

So I am assuming your are running your application locally from RStudio (no Shiny Server), right?
Can you please provide more information about your environment:

- Your Windows version
- Version of RStudio
- output of sessionInfo() command 

And if you don't mind sharing your code, we could take a look it (you can send it privately if you prefer).


Fereshteh

Thomas Chauvet

unread,
Aug 12, 2014, 4:11:58 AM8/12/14
to shiny-...@googlegroups.com
Thank you for your help Fereshteh. I find a solution in adding the line load(my.RData) at the begining of the ui.R.

I think my file was pretty heavy and the ui.R use a variable of this file, so the app doesn't have enough time to load the data and display the UI maybe.

Problem solved ! Thank you !
Reply all
Reply to author
Forward
0 new messages