如何从R中的闪亮应用程序中获取的输入创建pdf(特定格式)?
我已经创建了一个闪亮的应用程序,允许您输入产品、数量和价格的信息,并给出输出。我想让用户下载到一个不同格式的pdf文件 这是我的密码 用户界面代码如何从R中的闪亮应用程序中获取的输入创建pdf(特定格式)?,r,pdf,shiny,shinydashboard,shinyapps,R,Pdf,Shiny,Shinydashboard,Shinyapps,我已经创建了一个闪亮的应用程序,允许您输入产品、数量和价格的信息,并给出输出。我想让用户下载到一个不同格式的pdf文件 这是我的密码 用户界面代码 body <- dashboardBody( tabItem( tabName = 'Create_PI', inputPanel( selectizeInput(inputId = 'Customer_Name',label='Customer Name',
body <- dashboardBody(
tabItem(
tabName = 'Create_PI',
inputPanel(
selectizeInput(inputId = 'Customer_Name',label='Customer Name',
choices= sales$Customer, options = list(create=T)),
textInput(inputId = 'Contact',label='Contact Person'),
dateInput(inputId = 'Date', label = 'Date', format = 'dd MM yy')),
inputPanel(
selectizeInput(inputId = 'Product_Name1', label='Product Name',
choices= sales$Product, options = list(create=T)),
numericInput(inputId = 'Quantity1',value=0,label = 'Quantity (kg)',
min = 1, width = '100px'),
numericInput(inputId = 'Rate1',value=0,label = 'Rate (INR/kg)',
min = 1, width = '100px'),
textOutput(outputId = 'total1')
),
inputPanel(
selectizeInput(inputId = 'Product_Name2', label='Product Name',
choices= sales$Product, options = list(create=T)),
numericInput(inputId = 'Quantity2',value=0,label = 'Quantity (kg)',
min = 1, width = '100px'),
numericInput(inputId = 'Rate2',value=0,label = 'Rate (INR/kg)',
min = 1, width = '100px'),
textOutput(outputId = 'total2')
),
inputPanel(
numericInput(inputId = 'CGST', value = 9, label = 'CGST'),
numericInput(inputId = 'SGST', value = 9, label = 'SGST'),
textOutput(outputId = 'Final_Total'),
downloadButton(outputId = 'Create',label='Create PI')
)
)
body我们可以使用swave
或markdown
以及latex发行版和/或pandoc来创建PDF或html甚至docx文件谢谢,我来看看这些选项。是否有示例代码可供参考?
### The PI part
server <- function(input, output) {
output$total1 <- renderText(
paste('INR',formatC(input$Quantity1*input$Rate1, format="d", big.mark=','))
)
output$total2 <- renderText(
paste('INR',formatC(input$Quantity2*input$Rate2, format="d", big.mark=','))
)
output$Final_Total <- renderText({
total1 <- input$Quantity1*input$Rate1
total1[is.na(total1)] <-0
total2<-input$Quantity2*input$Rate2
total2[is.na(total2)]<-0
gst <- (input$CGST+input$SGST)/100
finaltotal <- total1+total2+(gst*(total1+total2))
paste('Final Rate INR',formatC(finaltotal, format="d", big.mark=','))
})
}