-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTwitterSocialAnalyzer.R
101 lines (69 loc) · 1.96 KB
/
TwitterSocialAnalyzer.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
install.packages("twitteR")
install.packages("ROAuth")
install.packages("tm")
install.packages("RCurl")
install.packages("tidyverse")
install.packages("lubridate")
library(twitteR)
library(ROAuth)
library(tm)
library(RCurl)
library(tidyverse)
library(lubridate)
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))
api_key<-"Sansure"
api_secret_key<-"Sansure"
access_token<-"Sansure"
access_secret_token<-"Sansure"
setup_twitter_oauth(api_key, api_secret, access_token, access_token_secret)
availableTrendLocations()%>%filter(country == "Turkey")
t<-getTrends(2344174)
head(t, 10)
tw<-searchTwitter("#JorgeOnTheStage", n=200)
em<-userTimeline("elonmusk")
df_em<-twListToDF(em)
elm<-getUser("elonmusk")
attributes(elm)
elm$created
elm$description
elm$favoritesCount
elm$followersCount
elm$followRequestSent
elm$friendsCount
elm$id
elm$lang
elm$lastStatus
elm$listedCount
elm$profileImageUrl
download.file("http://pbs.twimg.com/profile_images/1529956155937759233/Nyn1HZWF_normal.jpg", destfile = "picture")
elm$getFavorites(n=10)
elm$getFriends(n=5)
elm$getFollowerIDs(n=10)
df_user<-userTimeline("elonmusk")
df_1<-twListToDF(df_user)
df_1%>%
select(text,favoriteCount)%>%
arrange(desc(favoriteCount))%>%
top_n(5)%>%
View()
df_user<-userTimeline("GalatasaraySK", n=2000)
df<-twListToDF(df_user)
saat<-hour(df$created)
hist(saat, col = "red",
xlab = "Saat araligi",
ylab = "Tweet sayisi")
gun<-wday(df$created, label = F)
hist(gun, col = "red",
xlab = "Gun",
ylab = "Tweet sayisi")
gun<-wday(df$created, label = T)
ggplot(df,aes(gun)) +geom_bar()
year(df$created)
kaynaklar<-df$statusSource
kaynaklar2<-gsub("</a>","",kaynaklar)
kaynaklar3<-strsplit(kaynaklar2,">")
kaynaklar4<-sapply(kaynaklar3, function(x) x[2])
table(kaynaklar4)
kaynak_tablosu<-table(kaynaklar4)
kaynak_tablosu
pie(kaynak_tablosu)