Do not know how to convert "dataframe" to class “POSIXct” on uBuntu 16.04

this time I tried to run my shiny application from shiny-server environment that i build on my uBuntu 16.04. the application code are like this:

library(shiny)
library(reshape2)
library(ggplot2)
library(dplyr)
library(grid)
library(gridExtra)
library(RODBC)

variance <- function(x) var(x)*(length(x)-1)/length(x)

source("./src/ETL_DB_conn.R", encoding = "UTF-8")

ketten_mst<-read.csv("data/欠点マスタ_ECPU.csv")

Seisan_Stop<-read.csv("data/成形作業日報_不良履歴_ストップ抜粋.csv")

SeikeiDaily<-sqlQuery(conn,"select * from kashima.IOT_T_SeikeiDailyReport_PartNo_Detail;")
ServiceTank<-sqlQuery(conn,"select * from kashima.IOT_T_ServiceTank;")

SirakijiBad<-sqlQuery(conn,"select * from dbo.ECPU_TH_SirakijiBadDtl;")
SeihinBad<-sqlQuery(conn,"select * from dbo.ECPU_TH_SeihinBadDtl;")

Seikei_huryo<-sqlQuery(conn,"select * from kashima.IOT_T_SeikeiDailyReport_MoldingDefect;")

ServiceTank<-ServiceTank[,c(1,2,4,5,6,7,8,9,10,11,12,13)]
**ServiceTank$測定日<-as.POSIXct(ServiceTank$測定日)**

SeikeiDaily<-SeikeiDaily[,c(2,3,4,7,8,9,10,11,12,13)]
SeikeiDaily$成形日<-as.POSIXct(SeikeiDaily$成形日)
SeikeiDaily$タンク<-ifelse(SeikeiDaily$ライン==2,"Z2","Z1")

this code run perfectly on my local, but when I released it on shiny-server it gives this error:

do not know how to convert 'ServiceTank$測定日' to class “POSIXct”

this is the ServiceTank$測定日 should look like

測定日
2016/04/02
2016/04/04
2016/04/05
2016/04/06
2016/04/08
2016/04/09
2016/04/11
2016/04/12
2016/04/13
2016/04/15
2016/04/16
2016/04/18
2016/04/19
2016/04/20

my questions are:

  1. 1.why do POSIXct could run perfectly on windows 10 but not on shiny-server. my shiny-server run on ubuntu 16.04. some difference between this 2 environment beside OS are on my windows 10 my app connect to DB using SQL server ODBC why on ubuntu it connect through tdsodbc.
  2. 2.I got this error info from my shiny-server log only. I wanted to try and debug it using rstudio on my uBuntu server. but, everytime I try to click on the rstudio GUI it always crash for some reason. do anyone have any good way to debugging application on uBuntu server?

Best regards

1 answer

  • answered 2018-08-09 22:58 JohnCoene

    DF <- data.frame(date = Sys.Date())
    
    as.POSIXct(DF) # gives your error
    
    DF$date <- as.POSIXct(DF$date) # works