用一列在R中读取XLSX。如何删除日期r添加?
我有一个Excel表,想使用read_xlsx
将其转换为R DataFrame。
最初,在Excel中,数据看起来像这样:
dep_time
15:37:48
04:05:14
但是,在使用read_xlsx
之后,时间列如下所示:
dep_time
1899-12-31 15:37:48
1899-12-31 04:05:14
我不想在未来的图中绘制日期。我该如何避免这种情况?
谢谢!
I have one excel table and would like to use read_xlsx
to convert it as an R dataframe.
Originally, in excel, the data looks like this:
dep_time
15:37:48
04:05:14
However, after I use the read_xlsx
, the time column is something like below:
dep_time
1899-12-31 15:37:48
1899-12-31 04:05:14
I don't want to have the date in my future figure plotting. How can I avoid this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是解决问题的两种替代方法。
他们都使用辅助函数
to_times
来提取列值的时间部分。基本r
由
软件包
CHRON
在2022-05-04创建的 reprex package (v2.0.1)
Here are two alternative ways to solve the problem.
They both use an auxiliary function
to_times
to extract the time part of the column value.Base R
Created on 2022-05-04 by the reprex package (v2.0.1)
Package
chron
Created on 2022-05-04 by the reprex package (v2.0.1)