[问题] shiny执行source可执行但出现Warnings

楼主: 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
作者: Wush978 (拒看低质媒体)   2018-07-19 15:07:00
比对看看你跑shiny的sessionInfo()与没warnings时的sessionInfo(),注意一下环境变量相关的设定有无一致
楼主: e181280 (冥 〞)   2018-07-19 15:42:00
都一样耶...我是前后接续执行的
作者: andrew43 (讨厌有好心推文后删文者)   2018-07-19 15:45:00
警告讯息中指出的excel格是否手动检查过了?
作者: HumuHumu (呼姆呼姆)   2018-07-19 20:26:00
试试看source("global.R",encoding = "UTF-8")呢

Links booklink

Contact Us: admin [ a t ] ucptt.com