[英]Reading from CSV file in R and formatting dates and times with strptime()
I want to format my timestamp data with strptime()
我想用
strptime()
格式化我的时间戳数据
Reading from a txt file as a CSV ( read.csv(time.txt)
).从 txt 文件中读取为 CSV (
read.csv(time.txt)
)。 My time.txt only contains one column with dates, time.我的 time.txt 只包含一列日期和时间。 For example,
例如,
29/1/12 19:48
30/12/13 21:48
31/4/13 2:49
FYI, been instructed use only strptime()
function.仅供参考,已指示仅使用
strptime()
function。 I am getting the result something like this:我得到的结果是这样的:
V1
NA
mydata <- read.csv("time.txt", header = FALSE)
x <- mydata
strptime(x,format = "%d/%m/%y %H:%M")
Answered in comments:在评论中回答:
strptime(x$V1,format = "%d/%m/%y %H:%M")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.