1 ### COVID-19 Digital Observatory
4 ### Minimal example analysis file using trending search data
6 ### Import and cleanup data
9 url("https://github.com/CommunityDataScienceCollective/COVID-19_Digital_Observatory/blob/master/transliterations/data/output/related_searches_top.csv")
11 related.searches.top <- read.table(DataURL,
13 stringsAsFactors=FALSE)
15 ### Alternatively, uncomment and run if working locally with full git tree
16 ### Identify data source directory and file
17 ## DataDir <- ("../data/output/")
18 ## DataFile <- ("related_searches_top.csv")
20 ## related.searches.top <- read.table(paste(DataDir,DataFile, sep=""),
21 ## sep=",", header=TRUE,
22 ## stringsAsFactors=FALSE)
24 ### Aggregate top 5 search queries by term/day
25 top5.per.term.date <- aggregate(query ~ term + date,
26 data=related.searches.top,
29 ## Might cleanup a bit for further analysis or visualization...
30 top5.per.term.date$date <- as.Date(top5.per.term.date$date)
33 write.table(top5.per.term.date,
34 file="output/top5_queries_per_term_per_date.csv", sep=",",