Search code examples
rggvis

R markdown using ggvis returns error: could not find function "knit_print"


I'm interested in using ggvis in some markdown documents I'm creating. I know ggvis isn't 'ready' yet and is still in development but whenever I try embedding a ggvis visualization I get the following error:

Quitting from lines 23-25 (Preview-27581bfac8.Rmd) Error in knit_print.ggvis(x, options = options) : could not find function "knit_print" Calls: ... withVisible -> value_fun -> fun -> knit_print.ggvis Execution halted

I'm using . . . R Studio 0.98.976 R 3.1.0 and all my packages are up to date.

Any ideas on what might not be working?

I've done some google searching and examined the ggvis github page with no luck.


Solution

  • The problem seems to be that the current stable version of ggvis (i.e. the CRAN version) does not include a knit_print.ggvis function.

    However, the github repository of ggvis does include this function, see:

    https://github.com/rstudio/ggvis/blob/master/R/print.R

    Therefore I suggest you install the development version:

    # install the devtools package in case you don't have it already
    install.packages('devtools')
    
    # download the development version of ggvis
    devtools::install_github("rstudio/ggvis", build_vignettes = FALSE)
    

    Restart your R session. It should now work.

    Out of curiosity, are you also in the data products course?