当我将代码移至非闪亮的r环境时,它工作得很好,并且能够从要素转换为日期。但是,当我将代码移至闪亮的环境时。它似乎不起作用。这是我得到的错误。
Warning: Error in as.Date.default: do not know how to convert 'tik' to class “Date”
#Datasets
1. datatables
Client Amount Reason
0000001440MACT800 100000 6866755276
2. datatable
CLIENTID UPDATED-BY DEPOSIT-TYPE AMOUNT UPDATED-ON
0000001451MACT800 ADMIN Cash-Deposit 100,000.00 7/14/2016 09:33
0000001002MACT800 ADMIN Cash-Deposit 100,000.00 7/14/2016 09:23
0000001006MACT800 ADMIN Cash-Deposit 1,500,000.00 10/3/2016 11:48
0000001440MACT800 ADMIN Cash-Deposit 100,000.00 7/12/2016 14:13
0000001022MACT800 ADMIN Cash-Deposit 150,000.00 10/6/2016 14:23
0000001024MACT800 ADMIN Cash-Deposit 100,000.00 7/20/2016 08:18
0000001032MACT800 ADMIN Cash-Deposit 100,000.00 7/20/2016 08:17
0000001034MACT800 ADMIN Cash-Deposit 50,000.00 7/20/2016 08:29
0000001037MACT800 ADMIN Cash-Deposit 100,000.00 7/20/2016 08:17
0000001440MACT800 ADMIN Cash-Deposit 1,000,000.00 11/3/2016 14:40
0000001053MACT800 ADMIN Cash-Deposit 1,000,000.00 11/3/2016 14:51
0000001053MACT800 ADMIN Cash-Deposit 5,000,000.00 11/9/2016 15:02
0000001082MACT800 ADMIN Cash-Deposit 500,000.00 11/2/2016 12:47
0000001451MACT800 ADMIN Cash-Deposit 7,000,000.00 11/15/2016 13:12
0000001099MACT800 ADMIN Cash-Deposit 6,404,564.00 11/17/2016 14:23
0000001101MACT800 ADMIN Cash-Deposit 50,000.00 11/2/2016 12:50
代码如下。
#ui.R
library(shinydashboard)
#library(shiny)
library(DT)
dashboardPage(
dashboardHeader(title = "ALTX Fees"),
dashboardSidebar(
sidebarMenu(
menuItem("File Analysis"),
menuItem("Upload .csv file",tabName = "upload",icon = icon("upload")),
menuItem("Uploaded utrade file", tabName = "current", icon = icon("file")),
menuItem("Uploaded cash deposit file", tabName = "tevin", icon = icon("file")),
menuItem("Account maintenance fees",tabName = "phillo",icon = icon("money")),
menuItem("Updated cash deposit", tabName = "calvin", icon = icon("money"))
#menuItem(uiOutput("select file"))
)
),
dashboardBody(
tabItems(
tabItem(tabName = "upload",
fluidRow(
box(title = "Upload utrade cash deposit .csv file", status = "warning", solidHeader = TRUE,
width = 12,
input <- fileInput('file','', accept = '.csv', multiple = T ),
tags$hr(),
checkboxInput('header', 'Header', TRUE),
radioButtons('sep', 'Separator',c(Comma=',',Semicolon=';',Tab='\t'),',')))
),
tabItem(tabName = "current",
fluidRow(
box(title="Utrade cash deposit file",status = "warning", solidHeader = TRUE,
width = 20,
box(
width = 18,
dataTableOutput("contents")
)
) )),
tabItem(tabName = "tevin",
fluidRow(
box(title="Cash deposit file",status = "warning", solidHeader = TRUE,
width = 20,
box(
width = 18,
dataTableOutput("terry")
)
)
)),
#code for the account maintenance fees
tabItem(tabName = "phillo",
fluidRow(
box(title="Account Maintenance fees",status = "warning", solidHeader = TRUE,
width = 20,
box(
width = 18,
dataTableOutput("marvin"),
downloadLink("meem", "Download CSV")
)
)
)
),
# code for the updated csv
tabItem(tabName = "calvin",
fluidRow(
box(title="Updated Cash Deposit file",status = "warning", solidHeader = TRUE,
width = 20,
box(
width = 18,
dataTableOutput("tonia"),
downloadLink("downloadData", "Download CSV")
)
)
))
)
)
)
服务器端代码如下
#server.R
library(shinythemes)
library(shiny)
library(shinydashboard)
library(dplyr)
library(tidyr)
source("ui.R",local = TRUE)
function(input, output, session) {
dhh <- reactive({
inFile <- input$file
if (is.null(inFile)) return(NULL)
datatables <- read.csv(input$file[[1, 'datapath']], check.names=FALSE)
return(datatables)
})
output$terry <- renderDataTable({
if (is.null(dhh)) return(NULL)
datatables <- data.frame(dhh())
datatables
})
mk <- reactive({
if (is.null(input$file)) return(NULL)
inFile <- input$file
datatable <- read.csv(input$file[[2, 'datapath']], check.names=FALSE)
return(datatable)
})
output$contents <- renderDataTable({
if (is.null(mk)) return(NULL)
datatable <- data.frame(mk())
datatable
})
vino <- reactive({
jcole <- dhh()
kendrick <- mk()
# Make the dataframe with the help of data.frame()
mad <- data.frame(kendrick)
mat <- data.frame(jcole)
# Use str() to get more info about `writers_df`
str(mad)
str(mat)
tom = data.frame(mad$CLIENTID)
tom
tim = data.frame(mat$client)
tim
tin = data.frame(mad$UPDATED.ON)
tok = tin[1,1]
tik = data.frame(tok)
tik
str(tik)
#ten = toString(tik)
uu = as.Date(tik, format = "%m/%d/%Y")
#tap = as.Date(ten, format = "%m/%d/%Y")
tip = data.frame(uu)
tip
#tam = as.Date(factor(tik))
#tam
})
output$tonia <- renderDataTable({
vino()
})
在发亮的环境中,我发现这是一种相当奇怪的行为。有没有做对的事情?请帮助
tam = as.Date(factor(tik, format = "%m/%d/%Y"))
tam
我尝试使用此解决方案退出了stackoverflow页面,但并没有真正改变。