作者:
e181280 (冥 〞)
2018-07-19 08:38:29[問題類型]:
程式諮詢(我想用R 做某件事情,但是我不知道要怎麼用R 寫出來)
[軟體熟悉度]:
入門(寫過其他程式,只是對語法不熟悉)
[問題敘述]:
想在shiny中顯示一個table,
table是在另一個R script中進行處理(從讀取Excel到mapping,無Warnings訊息)
所以在shiny中想要透過source去執行另一個R script
但卻出現Warnings,目前知道應該是另一個R script在讀取excel產生的,
網路上找了些資料但還是不知道該如何處理
[程式範例]:
1.shiny script
source("A.R", local = TRUE)
2.A script
mapping_old.rul <-"Desktop/檔案/檔案A/【測試檔案】20180718.xls"
mapping_old <- read_excel(mapping_old.url, range = "B3:N103",
col_types = c("text", "text", "text", "numeric",
"text", "text", "text", "numeric",
"numeric", "numeric", "numeric",
"numeric", "numeric"))
p.s. 原始I欄位在讀取是型態為double但顯示出來為"1900-05-24 02:03:57",
我有強制改為numeric
p.s. 單獨執行A script時沒有出現任何warnings訊息,但在shiny中用source執行就有
Warning messages:
1: In read_fun(path = path, sheet_i = sheet, limits = limits, ... :
Expecting numeric in I4 / R4C9: got a date
2: In read_fun(path = path, sheet_i = sheet, limits = limits, ... :
Expecting numeric in I5 / R5C9: got a date
3: In read_fun(path = path, sheet_i = sheet, limits = limits, ... :
Expecting numeric in I6 / R6C9: got a date
4: In read_fun(path = path, sheet_i = sheet, limits = limits, ... :
Expecting numeric in I7 / R7C9: got a date
5: In read_fun(path = path, sheet_i = sheet, limits = limits, ... :
Expecting numeric in I8 / R8C9: got a date
6: In read_fun(path = path, sheet_i = sheet, limits = limits, ... :
Expecting numeric in I9 / R9C9: got a date
[環境敘述]:
R studio mac
[關鍵字]:
shiny, source, readxl
作者: HumuHumu (呼姆呼姆) 2018-07-19 20:26:00
試試看source("global.R",encoding = "UTF-8")呢