![](/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.