gpt4 book ai didi

r - 写入.csv : Error in charToDate(x) : character string is not in a standard unambiguous format

转载 作者:行者123 更新时间:2023-12-01 15:00:52 27 4
gpt4 key购买 nike

我正在尝试将具有以下结构的 data.table 写入光盘:

Classes ‘data.table’ and 'data.frame':  408776 obs. of  13 variables: $ date     : IDate, format: "2013-02-01" "2013-02-01" "2013-02-01" "2013-02-01" ... $ hour     : int  1 1 1 1 1 1 2 2 2 2 ... $ time     :Class 'ITime'  int [1:408776] 16 186 218 229 463 474 16 186 208 218 ... $ bids_med : num  NA NA NA 2.1 2.1 4.6 NA 7.5 7.5 7.5 ... $ bids_n   : int  NA NA NA 2 2 2 NA 4 4 4 ... $ asks_med : num  NA NA NA 21.5 21.5 21.5 NA 21 21 21 ... $ asks_n   : int  NA NA NA 2 2 2 NA 5 5 5 ... $ bprice   : num  5 4.2 4.2 4.2 5 5 9 9 9 10 ... $ bqty     : int  19 10 10 10 5 5 25 25 50 20 ... $ aprice   : num  16 16 21 21 21 21 19 19 19 19 ... $ aqty     : int  25 6 50 50 50 50 50 50 50 50 ... $ lastprice: num  7 16 16 16 16 16 9 9 9 9 ... $ lastqty  : int  31 19 6 6 6 6 25 25 25 25 ... - attr(*, "sorted")= chr  "date" "hour" "time" - attr(*, ".internal.selfref")= 

我收到以下错误:

> write.csv("data/probit.csv", training, row.names = FALSE)Error in charToDate(x) :   character string is not in a standard unambiguous format

重现:

structure(list(date = structure(c(15737L, 15737L, 15737L, 15737L, 15737L, 15737L), class = c("IDate", "Date")), hour = c(1L, 1L, 1L, 1L, 1L, 1L), time = structure(c(16L, 186L, 218L, 229L, 463L, 474L), class = "ITime"), bids_med = c(NA, NA, NA, 2.1, 2.1, 4.6), bids_n = c(NA, NA, NA, 2L, 2L, 2L), asks_med = c(NA, NA, NA, 21.5, 21.5, 21.5), asks_n = c(NA, NA, NA, 2L, 2L, 2L), bprice = c(5, 4.2, 4.2, 4.2, 5, 5), bqty = c(19L, 10L, 10L, 10L, 5L, 5L), aprice = c(16, 16, 21, 21, 21, 21), aqty = c(25L, 6L, 50L, 50L, 50L, 50L), lastprice = c(7, 16, 16, 16, 16, 16), lastqty = c(31L, 19L, 6L, 6L, 6L, 6L)), .Names = c("date", "hour", "time", "bids_med", "bids_n", "asks_med", "asks_n", "bprice", "bqty", "aprice", "aqty", "lastprice", "lastqty"), sorted = c("date", "hour", "time"), class = c("data.table", "data.frame"), row.names = c(NA, -6L))

我完全不知道该怎么办。有什么建议可以帮助吗?谢谢。

最佳答案

您只是让 write.csv 的参数乱序了。如果按位置传递,则首先是 data.frame 或 data.table,然后是文件名。你也可以先写 file= :

write.csv(file="out.csv",training,row.names=FALSE)

write.csv(training,"out.csv",row.names=FALSE)

关于r - 写入.csv : Error in charToDate(x) : character string is not in a standard unambiguous format,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18452907/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com