Untitled
unknown
plain_text
2 years ago
808 B
17
Indexable
# 2.
tweets=function(city) {
for (i in content) {
target_content=c()
if (grepl(city, content)) {
rbind(target_content, content[i])
}
}
count_activities(target_content, city)
}
# 3.
count_activities=function(rows, city) {
number_act=rep(0, length(activities))
for (i in seq_along(activities)) {
for (j in activities[[i]]) {
number_act[i]=number_act[i]+sum(j %in% rows)
}
}
plot_graph(number_act, city)
}
# 4.
plot_graph=function(d, city) {
print(d, city)
#activity_counts=count_activities(d, city)
#percentages=round(100 * activity_counts / sum(activity_counts), 1)
#pie(activity_counts, labels=paste(names(activity_counts), '\n',
# percentages, '%'), main='Activity Distribution')
#jpeg('pie_chart_city')
#dev.off()
}
#print(d, city)Editor is loading...
Leave a Comment