public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Andrew Scotchmer <andrew.scotchmer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Pandoc Error with Rmarkdown and Shiny
Date: Fri, 25 Aug 2017 01:24:04 -0700 (PDT)	[thread overview]
Message-ID: <1c67925b-ebef-4e18-ba6d-477292e07160@googlegroups.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2452 bytes --]

Hi

I have a simple R shiny app.  Whenever I try and download the table I 
created I get the following error:

pandoc: Cannot decode byte '\xfe': 
Data.Text.Internal.Encoding.Fusion.streamUtf8: Invalid UTF-8 stream 
Warning: Error in : pandoc document conversion failed with error 1 Stack 
trace (innermost first): 
    53: pandoc_convert
     52: convert
    51: rmarkdown::render 
    50: download$func [/home/scotcan1/Webshot/app.R#50]
      1: shiny::runApp 
Error : pandoc document conversion failed with error 1

I don't know what this means.   Here is my R/Shiny script and Rmarkdown.

*R:*
library(shiny)
library(DT)
data(iris)
ui <- fluidPage(
  
  titlePanel("|Species Table"),
  
  sidebarLayout(
    sidebarPanel(
      selectInput("specs",
                  "Number of bins:",
                  unique(iris$Species)),
      downloadButton("download", "Download Report")
    ),
    
    mainPanel(
      tableOutput("specTable")
    )
    
  )
  
)
server <- function(input, output) {
  
  subSpec <- function(x){
    testdat <- iris[iris$Species == x, ]
    return(testdat[1:10,])
  }
  
  reactiveFunction <- reactive({ subSpec(input$specs) })
  
  
  output$reactiveTable <- renderDataTable({ reactiveFunction() }, rownames = 
FALSE)
  
  output$specTable <- renderUI({
    dataTableOutput("reactiveTable")
    
  })
  
  
  
  output$download <- downloadHandler(
    filename <- "report_file.html",
    
    content <- function(file){
      write.csv(reactiveFunction(), "test_csv.csv", row.names = FALSE)
      params <- list(data = reactiveFunction())
      rmarkdown::render(filename, output_file = file)
    }
  )
}
shinyApp(ui = ui, server = server)



*Rmarkdown:*
---
title: "Untitled"
output: html_document
params:
  data: NA
---

```{r, echo=FALSE}
data(iris)
library(DT)
datatable(params$data)
```



Any help to interpret the error appreciated.

Andrew

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1c67925b-ebef-4e18-ba6d-477292e07160%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 19648 bytes --]

             reply	other threads:[~2017-08-25  8:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25  8:24 Andrew Scotchmer [this message]
     [not found] ` <1c67925b-ebef-4e18-ba6d-477292e07160-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-08-25 14:15   ` John MacFarlane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c67925b-ebef-4e18-ba6d-477292e07160@googlegroups.com \
    --to=andrew.scotchmer-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).