{"id":16572590,"url":"https://github.com/knapply/tweetgraph","last_synced_at":"2026-05-27T13:38:51.650Z","repository":{"id":105873634,"uuid":"206787842","full_name":"knapply/tweetgraph","owner":"knapply","description":"Model tweet data as various graph structures.","archived":false,"fork":false,"pushed_at":"2019-10-18T00:33:47.000Z","size":9709,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-16T03:14:24.535Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://knapply.github.io/tweetgraph/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knapply.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-06T12:20:32.000Z","updated_at":"2019-10-18T00:33:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"7c675271-55ca-4dd8-b730-e618ca84cfc1","html_url":"https://github.com/knapply/tweetgraph","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knapply%2Ftweetgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knapply%2Ftweetgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knapply%2Ftweetgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knapply%2Ftweetgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knapply","download_url":"https://codeload.github.com/knapply/tweetgraph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242041671,"owners_count":20062261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T21:28:02.910Z","updated_at":"2026-05-27T13:38:46.615Z","avatar_url":"https://github.com/knapply.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003c!-- README.Rmd generates README.md. --\u003e\n\n# `{tweetgraph}`\n\n\u003c!-- badges: start --\u003e\n\n[![Lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n[![GitHub last\ncommit](https://img.shields.io/github/last-commit/knapply/tweetgraph.svg)](https://github.com/knapply/tweetgraph/commits/master)\n[![Codecov test\ncoverage](https://codecov.io/gh/knapply/tweetgraph/branch/master/graph/badge.svg)](https://codecov.io/gh/knapply/tweetgraph?branch=master)\n[![AppVeyor build\nstatus](https://ci.appveyor.com/api/projects/status/github/knapply/tweetgraph?branch=master\u0026svg=true)](https://ci.appveyor.com/project/knapply/tweetgraph)\n[![Travis-CI Build\nStatus](https://travis-ci.org/knapply/tweetgraph.svg?branch=master)](https://travis-ci.org/knapply/tweetgraph)\n[![License: GPL\nv3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![Depends](https://img.shields.io/badge/Depends-GNU_R%3E=3.6-blue.svg)](https://www.r-project.org/)\n[![GitHub code size in\nbytes](https://img.shields.io/github/languages/code-size/knapply/tweetgraph.svg)](https://github.com/knapply/tweetgraph)\n[![HitCount](http://hits.dwyl.io/knapply/tweetgraph.svg)](http://hits.dwyl.io/knapply/tweetgraph)\n\u003c!-- badges: end --\u003e\n\n# Installation\n\n``` r\n# install.packages(\"remotes\")\nremotes::install_github(\"knapply/tweetgraph\")\n```\n\n# Usage\n\n``` r\nlibrary(tweetgraph)\n\nhashtag_rstats \u003c- rtweet::search_tweets(\"#rstats\")\n```\n\n## Social Network Analysis\n\n### `as_sna_primitive()`\n\n``` r\nsna_data \u003c- as_sna_primitive(hashtag_rstats)\n\nlapply(sna_data, names)\n```\n\n    #\u003e $edges\n    #\u003e [1] \"from\"      \"to\"        \"action\"    \"status_id\" \"text\"      \"source\"   \n    #\u003e [7] \"lang\"     \n    #\u003e \n    #\u003e $nodes\n    #\u003e  [1] \"name\"               \"timestamp_ms\"       \"TWITTER_NAME\"      \n    #\u003e  [4] \"screen_name\"        \"location\"           \"description\"       \n    #\u003e  [7] \"url\"                \"protected\"          \"followers_count\"   \n    #\u003e [10] \"friends_count\"      \"listed_count\"       \"statuses_count\"    \n    #\u003e [13] \"favourites_count\"   \"account_created_at\" \"verified\"          \n    #\u003e [16] \"profile_url\"        \"account_lang\"       \"node_class\"\n\n### Using `{igraph}`\n\n``` r\nas_sna_igraph(hashtag_rstats)\n```\n\n    #\u003e IGRAPH 6fdbb99 DN-- 68 176 -- \n    #\u003e + attr: name (v/c), timestamp_ms (v/n), TWITTER_NAME (v/c),\n    #\u003e | screen_name (v/c), location (v/c), description (v/c), url (v/c),\n    #\u003e | protected (v/l), followers_count (v/n), friends_count (v/n),\n    #\u003e | listed_count (v/n), statuses_count (v/n), favourites_count\n    #\u003e | (v/n), account_created_at (v/n), verified (v/l), profile_url\n    #\u003e | (v/c), account_lang (v/l), node_class (v/c), action (e/c),\n    #\u003e | status_id (e/c), text (e/c), source (e/c), lang (e/c)\n    #\u003e + edges from 6fdbb99 (vertex names):\n    #\u003e [1] 1075011651366199297-\u003e144592995 1075011651366199297-\u003e144592995\n    #\u003e [3] 1075011651366199297-\u003e144592995 1075011651366199297-\u003e144592995\n    #\u003e + ... omitted several edges\n\n``` r\nas_sna_igraph(sna_data)\n```\n\n    #\u003e IGRAPH 6fdca54 DN-- 68 176 -- \n    #\u003e + attr: name (v/c), timestamp_ms (v/n), TWITTER_NAME (v/c),\n    #\u003e | screen_name (v/c), location (v/c), description (v/c), url (v/c),\n    #\u003e | protected (v/l), followers_count (v/n), friends_count (v/n),\n    #\u003e | listed_count (v/n), statuses_count (v/n), favourites_count\n    #\u003e | (v/n), account_created_at (v/n), verified (v/l), profile_url\n    #\u003e | (v/c), account_lang (v/l), node_class (v/c), action (e/c),\n    #\u003e | status_id (e/c), text (e/c), source (e/c), lang (e/c)\n    #\u003e + edges from 6fdca54 (vertex names):\n    #\u003e [1] 1075011651366199297-\u003e144592995 1075011651366199297-\u003e144592995\n    #\u003e [3] 1075011651366199297-\u003e144592995 1075011651366199297-\u003e144592995\n    #\u003e + ... omitted several edges\n\n``` r\nsna_data %\u003e% \n  as_sna_igraph() %\u003e% \n  plot_vis_net()\n```\n\n\u003cimg src=\"man/figures/unnamed-chunk-6-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n### Using `{network}`\n\n``` r\nas_sna_network(hashtag_rstats)\n```\n\n    #\u003e  Network attributes:\n    #\u003e   vertices = 68 \n    #\u003e   directed = TRUE \n    #\u003e   hyper = FALSE \n    #\u003e   loops = TRUE \n    #\u003e   multiple = TRUE \n    #\u003e   bipartite = FALSE \n    #\u003e   total edges= 176 \n    #\u003e     missing edges= 0 \n    #\u003e     non-missing edges= 176 \n    #\u003e \n    #\u003e  Vertex attribute names: \n    #\u003e     account_created_at account_lang description favourites_count followers_count friends_count listed_count location node_class profile_url protected screen_name statuses_count timestamp_ms TWITTER_NAME url verified vertex.names \n    #\u003e \n    #\u003e  Edge attribute names: \n    #\u003e     action lang source status_id text\n\n``` r\nas_sna_network(sna_data)\n```\n\n    #\u003e  Network attributes:\n    #\u003e   vertices = 68 \n    #\u003e   directed = TRUE \n    #\u003e   hyper = FALSE \n    #\u003e   loops = TRUE \n    #\u003e   multiple = TRUE \n    #\u003e   bipartite = FALSE \n    #\u003e   total edges= 176 \n    #\u003e     missing edges= 0 \n    #\u003e     non-missing edges= 176 \n    #\u003e \n    #\u003e  Vertex attribute names: \n    #\u003e     account_created_at account_lang description favourites_count followers_count friends_count listed_count location node_class profile_url protected screen_name statuses_count timestamp_ms TWITTER_NAME url verified vertex.names \n    #\u003e \n    #\u003e  Edge attribute names: \n    #\u003e     action lang source status_id text\n\n## Write Gephi-Friendly .graphml Files\n\n``` r\ntarget_file_path \u003c- \"~/gephi-tweets.graphml\"\n\ntweet_graph \u003c- as_sna_igraph(hashtag_rstats)\n\nwrite_graphml(g = tweet_graph, path = target_file_path)\n```\n\n### Opening with Gephi\n\n1.  \n\u003cimg src=\"gephi-open.PNG\" style=\"display: block; margin: auto;\" /\u003e\n\n\u003cbr\u003e\u003cbr\u003e\n\n2.  \n\u003cimg src=\"gephi-open-2.PNG\" style=\"display: block; margin: auto;\" /\u003e\n\n\u003cbr\u003e\u003cbr\u003e\n\n3.  \n\u003cimg src=\"gephi-open-3.PNG\" style=\"display: block; margin: auto;\" /\u003e\n\n\u003cbr\u003e\u003cbr\u003e\n\n4.  \n\u003cimg src=\"gephi-open-4.PNG\" style=\"display: block; margin: auto;\" /\u003e\n\n\u003cimg src=\"gephi-open-5.PNG\" style=\"display: block; margin: auto;\" /\u003e\n\n## Knowledge Graph\n\n### `as_kg_primitive()`\n\n``` r\nkg_data \u003c- as_kg_primitive(hashtag_rstats)\n\nlapply(kg_data, names)\n```\n\n    #\u003e $edges\n    #\u003e [1] \"source\"       \"target\"       \"time\"         \"source_class\"\n    #\u003e [5] \"action\"       \"target_class\"\n    #\u003e \n    #\u003e $nodes\n    #\u003e  [1] \"name\"               \"timestamp_ms\"       \"created_at\"        \n    #\u003e  [4] \"text\"               \"source\"             \"lang\"              \n    #\u003e  [7] \"node_class\"         \"TWITTER_NAME\"       \"screen_name\"       \n    #\u003e [10] \"location\"           \"description\"        \"url\"               \n    #\u003e [13] \"protected\"          \"followers_count\"    \"friends_count\"     \n    #\u003e [16] \"listed_count\"       \"statuses_count\"     \"favourites_count\"  \n    #\u003e [19] \"account_created_at\" \"verified\"           \"profile_url\"       \n    #\u003e [22] \"account_lang\"\n\n### Using `{igraph}`\n\n``` r\nas_kg_igraph(hashtag_rstats)\n```\n\n    #\u003e IGRAPH 720affa DN-- 247 851 -- \n    #\u003e + attr: name (v/c), timestamp_ms (v/n), created_at (v/n), text\n    #\u003e | (v/c), source (v/c), lang (v/c), node_class (v/c), TWITTER_NAME\n    #\u003e | (v/c), screen_name (v/c), location (v/c), description (v/c), url\n    #\u003e | (v/c), protected (v/l), followers_count (v/n), friends_count\n    #\u003e | (v/n), listed_count (v/n), statuses_count (v/n),\n    #\u003e | favourites_count (v/n), account_created_at (v/n), verified\n    #\u003e | (v/l), profile_url (v/c), account_lang (v/l), time (e/n),\n    #\u003e | source_class (e/c), action (e/c), target_class (e/c)\n    #\u003e + edges from 720affa (vertex names):\n    #\u003e [1] 1184982560247631873-\u003e1184989314238894080\n    #\u003e + ... omitted several edges\n\n``` r\nas_kg_igraph(kg_data)\n```\n\n    #\u003e IGRAPH 720b74e DN-- 247 851 -- \n    #\u003e + attr: name (v/c), timestamp_ms (v/n), created_at (v/n), text\n    #\u003e | (v/c), source (v/c), lang (v/c), node_class (v/c), TWITTER_NAME\n    #\u003e | (v/c), screen_name (v/c), location (v/c), description (v/c), url\n    #\u003e | (v/c), protected (v/l), followers_count (v/n), friends_count\n    #\u003e | (v/n), listed_count (v/n), statuses_count (v/n),\n    #\u003e | favourites_count (v/n), account_created_at (v/n), verified\n    #\u003e | (v/l), profile_url (v/c), account_lang (v/l), time (e/n),\n    #\u003e | source_class (e/c), action (e/c), target_class (e/c)\n    #\u003e + edges from 720b74e (vertex names):\n    #\u003e [1] 1184982560247631873-\u003e1184989314238894080\n    #\u003e + ... omitted several edges\n\n``` r\nkg_data %\u003e% \n  as_kg_igraph() %\u003e% \n  plot_vis_net()\n```\n\n\u003cimg src=\"man/figures/unnamed-chunk-16-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n### Using `{network}`\n\n``` r\nas_kg_network(hashtag_rstats)\n```\n\n    #\u003e  Network attributes:\n    #\u003e   vertices = 247 \n    #\u003e   directed = TRUE \n    #\u003e   hyper = FALSE \n    #\u003e   loops = TRUE \n    #\u003e   multiple = FALSE \n    #\u003e   bipartite = FALSE \n    #\u003e   total edges= 851 \n    #\u003e     missing edges= 0 \n    #\u003e     non-missing edges= 851 \n    #\u003e \n    #\u003e  Vertex attribute names: \n    #\u003e     account_created_at account_lang created_at description favourites_count followers_count friends_count lang listed_count location node_class profile_url protected screen_name source statuses_count text timestamp_ms TWITTER_NAME url verified vertex.names \n    #\u003e \n    #\u003e  Edge attribute names: \n    #\u003e     action source source_class target_class time\n\n``` r\nas_kg_network(kg_data)\n```\n\n    #\u003e  Network attributes:\n    #\u003e   vertices = 247 \n    #\u003e   directed = TRUE \n    #\u003e   hyper = FALSE \n    #\u003e   loops = TRUE \n    #\u003e   multiple = FALSE \n    #\u003e   bipartite = FALSE \n    #\u003e   total edges= 851 \n    #\u003e     missing edges= 0 \n    #\u003e     non-missing edges= 851 \n    #\u003e \n    #\u003e  Vertex attribute names: \n    #\u003e     account_created_at account_lang created_at description favourites_count followers_count friends_count lang listed_count location node_class profile_url protected screen_name source statuses_count text timestamp_ms TWITTER_NAME url verified vertex.names \n    #\u003e \n    #\u003e  Edge attribute names: \n    #\u003e     action source source_class target_class time\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknapply%2Ftweetgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknapply%2Ftweetgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknapply%2Ftweetgraph/lists"}