Browse Source

Merge branch 'date' of janwey/ilfs-data into master

janwey 1 year ago
parent
commit
4ff977a417
1 changed files with 12 additions and 6 deletions
  1. 12
    6
      collecto.R

+ 12
- 6
collecto.R View File

@@ -143,6 +143,7 @@ time <- sub(pattern = ".* ", x = twitter_timedate, replace = "")
143 143
 time <- gsub(pattern = ":", x = time, replace = "")
144 144
 date <- sub(pattern = " .*", x = twitter_timedate, replace = "")
145 145
 date <- gsub(pattern = "-", x = date, replace = "")
146
+fdat <- strptime(x = paste0(date, time), format = "%Y%m%d%H%M%S", tz = "CET")
146 147
 retw <- as.factor(twitter_rts)
147 148
 favs <- as.factor(twitter_fav)
148 149
 link <- as.character(twitter_url)
@@ -151,14 +152,15 @@ clnt <- as.character(twitter_client)
151 152
 user <- as.character(twitter_usr)
152 153
 
153 154
 ### Creating dataframe
154
-twitter <- data.frame(cbind(date, time, retw, favs, text, link, clnt, user))
155
+twitter <- data.frame(cbind(date, time, fdat, retw, favs, text, link, clnt, user))
155 156
 
156 157
 #### Clean-Up
157
-rm(list = c("date", "time", "retw", "favs", "text", "link", "clnt", "user"))
158
+rm(list = c("date", "time", "fdat", "retw", "favs", "text", "link", "clnt", "user"))
158 159
 
159 160
 twitter <- within(data = twitter, expr = {
160 161
 		     date <- as.character(date);
161 162
 		     time <- as.character(time);
163
+                     fdat <- as.character(fdat);
162 164
 		     text <- as.character(text);
163 165
 		     link <- as.character(link);
164 166
 		  })
@@ -306,13 +308,15 @@ for(i in 1:999){
306 308
 }
307 309
 
308 310
 ### Time of post
309
-#### date (as numeric value)
311
+#### date
310 312
 date <- sub(pattern = "T.*", x = datetime, replacement = "")
311 313
 date <- gsub(pattern = "-", x = date, replacement = "")
312
-#### time (as numeric value)
314
+#### time
313 315
 time <- sub(pattern = ".*T", x = datetime, replacement = "")
314 316
 time <- sub(pattern = "\\..*", x = time, replacement = "")
315 317
 time <- gsub(pattern = ":", x = time, replacement = "")
318
+#### full time
319
+fdat <- strptime(x = paste0(date, time), format = "%Y%m%d%H%M%S", tz = "CET")
316 320
 
317 321
 ### Removing HTML-Tags from Toots
318 322
 text <- gsub(pattern = "<.*?>", x = text, replacement = "")
@@ -330,6 +334,7 @@ inst <- sub(pattern = "\\/.*", x = inst, replacement = "")
330 334
 mastodon_exclude <- which(as.numeric(date) < 20180210)
331 335
 date <- date[-mastodon_exclude]
332 336
 time <- time[-mastodon_exclude]
337
+fdat <- fdat[-mastodon_exclude]
333 338
 lang <- lang[-mastodon_exclude]
334 339
 inst <- inst[-mastodon_exclude]
335 340
 text <- text[-mastodon_exclude]
@@ -340,14 +345,15 @@ murl <- murl[-mastodon_exclude]
340 345
 acct <- acct[-mastodon_exclude]
341 346
 
342 347
 ### Creating dataframe
343
-mastodon <- data.frame(cbind(date, time, lang, inst, text, link, reto, favs, murl, acct))
348
+mastodon <- data.frame(cbind(date, time, fdat, lang, inst, text, link, reto, favs, murl, acct))
344 349
 
345 350
 #### Clean-Up
346
-rm(list = c("date", "time", "lang", "inst", "text", "link", "favs", "reto", "murl", "datetime", "acct"))
351
+rm(list = c("date", "time", "fdat", "lang", "inst", "text", "link", "favs", "reto", "murl", "datetime", "acct"))
347 352
 
348 353
 mastodon <- within(data = mastodon, expr = {
349 354
 		     date <- as.character(date);
350 355
 		     time <- as.character(time);
356
+                     fdat <- as.character(fdat);
351 357
 		     text <- as.character(text);
352 358
 		     link <- as.character(link);
353 359
 		     murl <- as.character(murl);

Loading…
Cancel
Save