user11626803
user11626803

Reputation:

Dealing with date format in R

I have a bunch of tweets which I have classified per topic. Having a dataset containing the date in this format YYYY-MM-DD H:M:S is there a way to plot the topics in time?

2020-11-02 07:45:47 | 1  #newest tweet
2020-11-03 09:41:10 | 5
2020-06-14 01:50:34 | 9  #oldest tweet

Upvotes: 0

Views: 31

Answers (1)

ThomasIsCoding
ThomasIsCoding

Reputation: 102770

Maybe you can try

df$V1 <- as.POSIXct(df$V1)
plot(df[order(df$V1), ])

enter image description here

Data

> dput(df)
structure(list(V1 = c("2020-11-02 07:45:47", "2020-11-03 09:41:10",
"2020-06-14 01:50:34"), V2 = c(1L, 5L, 9L)), class = "data.frame", row.names = c(NA,
-3L))

Upvotes: 0

Related Questions