lubridate - messages

删除回忆录丶 提交于 2019-12-24 23:26:37

问题


Will it be possible to suppress messages such as "Using date format..." when using a function like?

> ymd(vec)
Using date format %Y%m%d

Whilst these are good to see when you are casting a vector, it can be annoying in some circumstances.


回答1:


Looking at the ymd code, it callse parse_date, which gives those annoying messages via the command message.

Looking at ?message, there is a corresponding suppressMessages:

suppressMessages(ymd(x))

(Note - other similar functions are suppressWarnings, suppressPackageStartupMessages, and capture.output, all of which I have had to use in the past to stop unexpected bits of text turning up (I was outputting some bits to an HTML file and these didn't want these to be in it)).




回答2:


Manny, suppressMessages() is the only way to go at the moment. But I like your idea of an argument. I've put it on the todo list for lubridate. You could also use strptime() once you have the format for a vector of date-times.



来源:https://stackoverflow.com/questions/9168684/lubridate-messages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!