r - 如何将字符串转换为时间
问题描述
我有一列格式为“17:24:00”的字符串。我想转换成时间格式。当我使用 strptime 函数时,它会在时间前面添加日期。我不希望这种情况发生。任何人都知道如何避免添加日期。
chr [1:2075259] "17:24:00" "17:25:00" "17:26:00" "17:27:00" "17:28:00" ...
我试过这个 -
hpc$time<-strptime(hpc$time,format='%H:%M:%S')
它给了我以下结果-
POSIXlt[1:2075259], format: "2020-06-15 17:24:00" "2020-06-15 17:25:00" "2020-06-15 17:26:00" ...
解决方案
推荐阅读
- hibernate - Hibernate StaleObjectStateException 问题调用合并
- android - android:navigationBarDividerColor 需要 API 级别 28
- javascript - 关闭 Glide.js 轮播上的拖动
- javascript - WebSockets 在本地主机上工作,但在远程 Ubuntu 主机上不工作
- scala - Akka Streams - 了解物化何时以及如何工作
- jwplayer - 如何从 JWPlayer 获取#EXT-X-PROGRAM-DATE-TIME
- zooming - 升级到 v4.6.5 后不显示 Shift-zoom 边框
- java - 如何在 Spring 数据中读取 JSON 字符串并写入数据库 MySql
- elixir - Elixir/Phoenix/Guardian - 在 conn 中分配 current_user 不适用于测试
- python - 访问列表中第一个元素以外的元素不起作用