ramnathv / slidify

Generate reproducible html5 slides from R markdown
http://www.slidify.org
844 stars 339 forks source link

cannot find function"slidifyUI" #408

Open LaurentFranckx opened 9 years ago

LaurentFranckx commented 9 years ago

I have made an attempt to create an interactive feature to a slidify presentation, but when I "Knitted" the Index.Rmd file I got the message: cannot find function"slidifyUI".

This was the code I used inside index.Rmd. Should I have loaded another package before running the code?

library(slidify)
slidifyUI(
  sidebarPanel(
        fluidRow(
          h4("Show histogram for one selected variable:"),
          selectInput("histo_var", 
                      label = "Chosen variable:", 
                      list("mpg" = "mpg", "cyl" = "cyl", "disp" = "disp", "hp"= "hp", "drat" = "drat", "wt" = "wt", 
                           "qsec" = "qsec", "vs" = "vs","am"= "am", 
                           "gear"= "gear", "carb"= "carb"),
                      selected = "cyl"
          ),
          numericInput("bin", 
                       label = "Maximal number of bins:", 
                       value = 10)
          )
    ),
  mainPanel(
    h4('The histogram of the chosen variable is:'),
    plotOutput("plothisto")
  )
)
LaurentFranckx commented 9 years ago

Problem solved. I had overlooked that I needed to use runDeck() rather than "knitr" the presentation.

ptoche commented 9 years ago

Try to add library(slidifyLibraries).

Also add library(rCharts) on the server side, if that's what you're using.

You may also need to add widgets : shiny in the yaml at the top.

I haven't tried shiny in slidify before and your code is incomplete so I couldn't test it, hope you can get it to work!

LaurentFranckx commented 9 years ago

@ptoche Thanks for the comments. As noted above, my mistake was that I ran the wrong code (knitr instead of runDeck()). Unfortunately, yesterday, I found out that the problem is still not solved completely. So, when I run runDeck(), I get beautiful slides, and when I open them locally in a browser, everything works fine: all my grpahs and other function react correctly to the widgets. The trouble starts when I try to publish my results. The default after runDeck() is to deploy the slides on ShinyApps.io, but when I run the code on ShinyApps, I get the error message "cannot find function slidifyUI" that I got before under RStudio.

I have also verified whether I could publish it to RPubs. When I "knitr" the code, I get the error message:

Error: 'knit2slides' is not an exported object from 'namespace:slidify'

OK, so that doesn't work either. Any other suggestions?

ptoche commented 9 years ago

have you installed all the packages on ShinyApps.io? Running R from the console. I haven't used shiny for over a year because it was breaking all the time and I got fed up. I'm afraid I couldn't help more. All the best.