に数値の数字を変換することはできません、私が何をしたいデータの構造は、私がここで時間
がPOSIXct
へTime
のフォームを変更することです。
ここに私が試したことがあります。
a <- as.POSIXct(power_consumption$Time, "%H:%M:%S")
Error in as.POSIXlt.character(as.character(x), ...) :
字符串的格式不够标准明确(The format of the string is not standard enough)
a <- as.POSIXlt(power_consumption$Time, "%H:%M:%S")
Error in as.POSIXlt.character(as.character(x), ...) :
字符串的格式不够标准明确(The format of the string is not standard enough)
a <- strptime(power_consumption$Time, "%H:%M:%S")
head(a)
[1] NA "2017-07-07 17:24:00 CST" "2017-07-07 17:25:00 CST" "2017-07-07 17:26:00 CST" "2017-07-07 17:27:00 CST"
[6] "2017-07-07 17:28:00 CST"
私はTime
のstructionは時間だけを持っているため、結果は、右ではないと思います。
Time
を%H:%M:%S
に変換するにはどうすればよいですか?ありがとう
再現可能な例を示してください(データの画像では不十分です)。 –
['anytime'パッケージ](https://CRAN.R-project.org/package=anytime)を試してみてください。 – Gregor
私は時間だけを使う理由は考えていません。POSIXctには、 'dt < - as.POSIXct(paste(power_consumption $ Date、power_consumption $ Time)、"%d /%m /%Y% H:%M:%S ")' – HubertL