我正在将许多csv文件导入Rstudio,这些文件的列中包含日期和时间(最初是在熊猫中生成的)。文件导入没有任何问题,但是当我尝试将它们与rbind结合使用时,出现如下错误:
Error in as.POSIXlt.character(x, tz, ...) :
character string is not in a standard unambiguous format
我尝试设置时区,但这不起作用。
下面是显示类和对象外观的代码。
class(dd1$timestamp_datetime)
[1] "POSIXct" "POSIXt"
glimpse(dd1$timestamp_datetime)
POSIXct[1:10923], format: "2018-04-21 15:30:53" "2018-01-22 08:00:12" "2018-11-16 09:50:13" "2018-07-28 06:30:18" "2018-04-17 18:20:50"
该格式对我来说看起来不错,但对R而言不行。我计划将此数据集用于时间序列分析,因此datetime部分非常重要。我应该怎么做才能使其正常工作?
更新: 这里是。与数字都不同有关系吗?他们曾经是大熊猫的索引。删除此行会有所帮助吗?
glimpse(dd1$X1)
num [1:10923] 2 72 82 96 102 103 109 115 125 127 ...
> glimpse(dd2$X1)
chr [1:74615] "0" "1" "6" "7" "8" "9" "10" "11" "12" "13" "15" "16" "18" "19" "20" "21" "23" "25" "26" "27" "28" "30" "34" ...
> glimpse(dd3$X1)
chr [1:51843] "4" "6" "10" "13" "14" "15" "16" "22" "24" "27" "30" "33" "34" "35" "36" "38" "39" "41" "42" "49" "50" "51" ...
> glimpse(dd4$X1)
num [1:48747] 2 3 5 7 9 12 17 18 20 21 ...
已添加其他代码:
dput(head(dd1))
structure(list(X1 = c(2, 72, 82, 96, 102, 103), text = c("RT @ThatTimWalker: Can’t help but think the hostile environment the Brextremists are creating is for themselves.",
"RT @ThatTimWalker: The sad thing is if this country hadn’t been conned by Brextremists we’d be a very prosperous country now and respected…",
"RT @Kevin_Maguire: Update on Brextremist monied elite:\nJames Dyson: Building factory in Singapore\nJim Ratcliffe: Moving to Monaco\nArron Ban…",
"RT @ThatTimWalker: Why are the new revelations of dirty tricks and lies by the Brextremist groups during the EU Referendum considered stron…",
"RT @EK_EuropeanMove: #Kipper #Leaver or #Brextremist hard to tell which cannot tell the difference between the extreme right nationalist id…",
"RT @mrjamesob: May clearly thought that Brextremists would eventually be forced by the sheer weight of evidence & events to acknowledge rea…"
), timestamp_datetime = structure(c(1524324653.333, 1516608012.083,
1542361813.274, 1532759418.257, 1523989250.856, 1506776455.518
), class = c("POSIXct", "POSIXt"), tzone = "UTC"), tweet_id = c(987715301230903296,
955349361969393664, 1063368633320132608, 1023093269490790400,
986308521280106496, 914112824942657536), keyword = c("brextremist",
"brextremist", "brextremist", "brextremist", "brextremist", "brextremist"
)), row.names = c(NA, -6L), problems = structure(list(row = c(6721L,
6722L, 6722L, 6723L, 6723L, 6723L, 8175L, 8176L, 8176L, 8177L,
8177L, 8178L, 8178L, 8179L, 8179L, 8179L, 10805L, 10806L, 10806L,
10806L), col = c(NA, "X1", NA, "X1", "timestamp_datetime", NA,
NA, "X1", NA, "X1", NA, "X1", NA, "X1", "timestamp_datetime",
NA, NA, "X1", "timestamp_datetime", NA), expected = c("4 columns",
"a double", "4 columns", "a double", "date like ", "4 columns",
"4 columns", "a double", "4 columns", "a double", "4 columns",
"a double", "4 columns", "a double", "date like ", "4 columns",
"4 columns", "a double", "date like ", "4 columns"), actual = c("2 columns",
"#MacronPresident", "1 columns", , "861526132977434624",
"3 columns", "2 columns", "Blame Remainers", "1 columns", "Blame Scotland",
"1 columns", "Blame Ireland", "1 columns", "But never blame #PartybeforeCountry self serving #Brextremist #Tories",
"970756341433360385", "3 columns", "2 columns", "Ha.. You Brextremists are doing that brah. Be an adult and accept the consequences of your decision",
"803893962457153536", "3 columns"), file = c("'brextrem_only2.csv'",
"'brextrem_only2.csv'", "'brextrem_only2.csv'", "'brextrem_only2.csv'",
"'brextrem_only2.csv'", "'brextrem_only2.csv'", "'brextrem_only2.csv'",
"'brextrem_only2.csv'", "'brextrem_only2.csv'", "'brextrem_only2.csv'",
"'brextrem_only2.csv'", "'brextrem_only2.csv'", "'brextrem_only2.csv'",
"'brextrem_only2.csv'", "'brextrem_only2.csv'", "'brextrem_only2.csv'",
"'brextrem_only2.csv'", "'brextrem_only2.csv'", "'brextrem_only2.csv'",
"'brextrem_only2.csv'")), row.names = c(NA, -20L), class = c("tbl_df",
"tbl", "data.frame")), class = c("tbl_df", "tbl", "data.frame"
))
dput(head(dd2))
structure(list(X1 = c("0", "1", "6", "7", "8", "9"), text = c("@Bigandybruce @curtislauraj @davidschneider @daveleaper @Sean_x_Larkin The average remoaner has yet to have their b… ,
"RT @2tweetaboutit: Remoaner Emily Thornberry slapped down for trying to delay and complicate Brexit talks,
"RT @henrybutcher56: #Marr Marrs reference to Vince Cable as “remoaner in chief” once more exposes the disgraceful BBC news editorial bias t…",
"@jacquep @BrexitJustice Regarde:Not what remoaners want hear, more good news!",
"RT @CllrBSilvester: Two traitors who think they know better than the 17.4m.\nThe arrogance of the #REMOANERS is breathtaking.\nIf they think…",
"RT @arhselk: Great Tweet!Me thinks remoaner’s retweets will be as scarce as an unemployed financial expert living in London. “Project Pathe…"
), timestamp_datetime = c("2017-12-29 15:30:06.111", "2016-10-11 04:27:59.027",
"2018-04-30 10:50:30.577", "2016-09-02 13:14:53.566", "2018-07-20 21:10:40.279",
"2018-08-14 19:30:24.355"), tweet_id = c(946765274354765824,
785698434561019904, 990906232268521472, 771697908789968896, 1020415718184153088,
1029450182210015232), keyword = c("remoaner", "remoaner", "remoaner",
"remoaner", "remoaner", "remoaner")), row.names = c(NA, -6L), problems = structure(list(
row = c(106L, 107L, 108L, 109L, 110L, 111L, 1785L, 1786L,
3166L, 3167L, 3168L, 6078L, 6079L, 6080L, 6106L, 6107L, 6108L,
6250L, 6251L, 6252L, 6253L, 8568L, 8569L, 8737L, 8738L, 8739L,
8740L, 8744L, 8745L, 8746L, 13232L, 13233L, 13234L, 14713L,
14714L, 15675L, 15676L, 15677L, 18672L, 18673L, 19735L, 19736L,
19737L, 19738L, 19739L, 19740L, 19773L, 19774L, 19775L, 20609L,
20610L, 20611L, 20774L, 20775L, 20776L, 23594L, 23595L, 23596L,
23597L, 24658L, 24659L, 26747L, 26748L, 26749L, 28388L, 28389L,
28390L, 28530L, 28531L, 28532L, 28533L, 28969L, 28970L, 30090L,
30091L, 30539L, 30540L, 30541L, 37020L, 37021L, 37620L, 37621L,
38702L, 38703L, 39489L, 39490L, 40052L, 40053L, 40054L, 40729L,
40730L, 40731L, 40732L, 41786L, 41787L, 42883L, 42884L, 42885L,
46803L, 46804L, 50709L, 50710L, 50711L, 51985L, 51986L, 52230L,
52231L, 52232L, 52233L, 54097L, 54098L, 54099L, 54100L, 54134L,
54135L, 54136L, 54137L, 54251L, 54252L, 54253L, 57349L, 57350L,
57848L, 57849L, 57850L, 58202L, 58203L, 58204L, 59773L, 59774L,
59775L, 59776L, 59861L, 59862L, 59863L, 59864L, 60008L, 60009L,
60010L, 60227L, 60228L, 60339L, 60340L, 60341L, 60342L, 61573L,
61574L, 61575L, 61576L, 61577L, 61578L, 65302L, 65303L, 65772L,
65773L, 68813L, 68814L, 70690L, 70691L, 70997L, 70998L, 71710L,
71711L, 71712L, 71713L, 72172L, 72173L, 72174L, 72175L, 72218L,
72219L, 72220L, 72221L, 74473L, 74474L, 74475L, 74476L),
col = c(NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_), expected = c("4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns", "4 columns",
"4 columns", "4 columns", "4 columns", "4 columns"), actual = c("2 columns",
"1 columns", "1 columns", "1 columns", "1 columns", "3 columns",
"2 columns", "3 columns", "2 columns", "1 columns", "3 columns",
"2 columns", "1 columns", "3 columns", "2 columns", "1 columns",
"3 columns", "2 columns", "1 columns", "1 columns", "3 columns",
"2 columns", "3 columns", "2 columns", "1 columns", "1 columns",
"3 columns", "2 columns", "1 columns", "3 columns", "2 columns",
"1 columns", "3 columns", "2 columns", "3 columns", "2 columns",
"1 columns", "3 columns", "2 columns", "3 columns", "2 columns",
"1 columns", "1 columns", "1 columns", "1 columns", "3 columns",
"2 columns", "1 columns", "3 columns", "2 columns", "1 columns",
"3 columns", "2 columns", "1 columns", "3 columns", "2 columns",
"1 columns", "1 columns", "3 columns", "2 columns", "3 columns",
"2 columns", "1 columns", "3 columns", "2 columns", "1 columns",
"3 columns", "2 columns", "1 columns", "1 columns", "3 columns",
"2 columns", "3 columns", "2 columns", "3 columns", "2 columns",
"1 columns", "3 columns", "2 columns", "3 columns", "2 columns",
"3 columns", "2 columns", "3 columns", "2 columns", "3 columns",
"2 columns", "1 columns", "3 columns", "2 columns", "1 columns",
"1 columns", "3 columns", "2 columns", "3 columns", "2 columns",
"1 columns", "3 columns", "2 columns", "3 columns", "2 columns",
"1 columns", "3 columns", "2 columns", "3 columns", "2 columns",
"1 columns", "1 columns", "3 columns", "2 columns", "1 columns",
"1 columns", "3 columns", "2 columns", "1 columns", "1 columns",
"3 columns", "2 columns", "1 columns", "3 columns", "2 columns",
"3 columns", "2 columns", "1 columns", "3 columns", "2 columns",
"1 columns", "3 columns", "2 columns", "1 columns", "1 columns",
"3 columns", "2 columns", "1 columns", "1 columns", "3 columns",
"2 columns", "1 columns", "3 columns", "2 columns", "3 columns",
"2 columns", "1 columns", "1 columns", "3 columns", "2 columns",
"1 columns", "1 columns", "1 columns", "1 columns", "3 columns",
"2 columns", "3 columns", "2 columns", "3 columns", "2 columns",
"3 columns", "2 columns", "3 columns", "2 columns", "3 columns",
"2 columns", "1 columns", "1 columns", "3 columns", "2 columns",
"1 columns", "1 columns", "3 columns", "2 columns", "1 columns",
"1 columns", "3 columns", "2 columns", "1 columns", "1 columns",
"3 columns"), file = c("'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'", "'remoan_only2.csv'", "'remoan_only2.csv'",
"'remoan_only2.csv'")), row.names = c(NA, -177L), class = c("tbl_df",
"tbl", "data.frame")), class = c("tbl_df", "tbl", "data.frame"
))
>