我正在处理R中的数据集,其中的变量的持续时间为字符格式(2h,10m等)。
如何将其转换为分钟形式的分钟?
预先感谢
数据
>>>>>
**/mnt/c/code/kafka/bin$ confluent start
This CLI is intended for development only, not for production
https://docs.confluent.io/current/cli/index.html
Using CONFLUENT_CURRENT: /tmp/confluent.fnxwVjdZ
Starting zookeeper
zookeeper is [UP]
Starting kafka
|Kafka failed to start
kafka is [DOWN]
Cannot start Schema Registry, Kafka Server is not running. Check your deployment**
<<<
/mnt/c/code/kafka/bin$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
答案 0 :(得分:0)
您可以使用lubridate::period
将该对象转换为period
,然后根据需要转换为分钟,如下所示:
as.numeric(lubridate::period("2H 10M"), "minutes")
[1] 130