![](/img/trans.png)
[英]Reading CSV file in R and formatting dates and time while reading and avoiding missing values marked as?
[英]Reading from CSV file in R and formatting dates and times with strptime()
我想用strptime()
格式化我的时间戳数据
从 txt 文件中读取为 CSV ( read.csv(time.txt)
)。 我的 time.txt 只包含一列日期和时间。 例如,
29/1/12 19:48
30/12/13 21:48
31/4/13 2:49
仅供参考,已指示仅使用strptime()
function。 我得到的结果是这样的:
V1
NA
mydata <- read.csv("time.txt", header = FALSE)
x <- mydata
strptime(x,format = "%d/%m/%y %H:%M")
在评论中回答:
strptime(x$V1,format = "%d/%m/%y %H:%M")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.