Version: 0.5.7
Title: User Interface for Collecting and Analysing Social Networks
Description: A 'Shiny' application for the interactive visualisation and analysis of networks that also provides a web interface for collecting social media data using 'vosonSML'.
Type: Package
Imports: data.table, graphics, httpuv, httr, igraph (≥ 1.2.2), lattice, magrittr, RColorBrewer, shiny (≥ 1.3.2), SnowballC, systemfonts, syuzhet, textutils, tm, utils, vosonSML (≥ 0.29.0), wordcloud
Suggests: dplyr, DT, htmlwidgets, rtweet (≥ 0.6.8), shinydashboard, shinyjs, visNetwork
Depends: R (≥ 3.2.0)
Encoding: UTF-8
Author: Bryan Gertzel, Robert Ackland
Maintainer: Bryan Gertzel <bryan.gertzel@anu.edu.au>
License: GPL (≥ 3)
RoxygenNote: 7.1.1
NeedsCompilation: no
URL: https://github.com/vosonlab/VOSONDash
BugReports: https://github.com/vosonlab/VOSONDash/issues
Packaged: 2020-07-27 12:10:40 UTC; viole
Repository: CRAN
Date/Publication: 2020-07-27 13:20:02 UTC

Interface for collection and interactive analysis of social networks

Description

VOSONDash provides functions and an interface in the form of an interactive R Shiny web application for the visualisation and analysis of network data. The app has sections for visualising and manipulating network graphs, performing text analysis, and displaying network metrics. It also has an interface for the collection of social network data using the vosonSML R package.

Author(s)

Bryan Gertzel and Robert Ackland.


Add additional measures to graph as vertex attributes

Description

Adds degree, in-degree, out-degree, betweenness and closeness measures to graph as vertex attributes.

Usage

addAdditionalMeasures(g)

Arguments

g

igraph graph object.

Value

An igraph graph object.


Filter out graph vertices not in selected category

Description

This function removes vertices that are not in the selected categories values list or sub-categories.

Usage

applyCategoricalFilters(
  g,
  selected_cat,
  selected_subcats,
  cat_prefix = "vosonCA_"
)

Arguments

g

igraph graph object.

selected_cat

Character string. Selected vertex category without prefix.

selected_subcats

List. Selected sub-category values to include in graph.

cat_prefix

Character string. Category attribute prefix format to match. Default is "vosonCA_".

Value

An igraph graph object.

Examples

## Not run: 
# return a graph containing only vertices that have the vertex category 
# attribute "vosonCA_Stance" value "liberal"
g <- loadPackageGraph("DividedTheyBlog_40Alist_release.graphml")

g <- applyCategoricalFilters(g, "Stance", c("liberal"))

## End(Not run)


Filter out graph vertices not in component size range

Description

This function removes any graph vertices that are in components that fall outside of the specified component size range.

Usage

applyComponentFilter(g, component_type = "strong", component_range)

Arguments

g

igraph graph object.

component_type

Character string. Use strongly or weakly connected components by specifying "strong" or "weak". Ignored for undirected graphs. Default is "strong".

component_range

Numeric vector. Min and max values or size range of component.

Value

An igraph graph object.


Filter out graph vertices and edges from graph object that are isolates, multi edge or edge loops

Description

This function removes isolate vertices, multiple edges between vertices and or vertex edge loops from a graph.

Usage

applyGraphFilters(g, isolates = TRUE, multi_edge = TRUE, loops_edge = TRUE)

Arguments

g

igraph graph object.

isolates

Logical. Include isolate vertices in graph. Default is TRUE.

multi_edge

Logical. Include multiple edges between vertices in graph. Default is TRUE.

loops_edge

Logical. Include vertex edge loops in graph. Default is TRUE.

Value

An igraph graph object.

Note

Removing multiple edges or edge loops from a graph will simplify it and remove other edge attributes.


Prune vertices from graph by vertex id

Description

This function removes a list of vertices from the graph object by vertex id value.

Usage

applyPruneFilter(g, selected_prune_verts)

Arguments

g

igraph graph object.

selected_prune_verts

List. Selected vertex ids to remove.

Value

An igraph graph object.


Collect reddit data

Description

This function is a wrapper for collecting reddit thread comments using vosonSML::Collect.

Usage

collectRedditData(reddit_url_list)

Arguments

reddit_url_list

Character vector. Thread urls to collect comments from.

Value

A vosonSML reddit dataframe.


Collect twitter data

Description

This function is a wrapper for collecting tweets using vosonSML::Collect.

Usage

collectTwitterData(
  cred,
  search_term,
  search_type,
  tweet_count,
  include_retweets,
  retry_on_rate_limit,
  language,
  date_until,
  since_id,
  max_id
)

Arguments

cred

vosonSML twitter credential object.

search_term

Character string. Twitter search term.

search_type

Character string. Search type "mixed", "recent" or "popular".

tweet_count

Numeric. Number of tweets to collect.

include_retweets

Logical. Include retweets in the results.

retry_on_rate_limit

Logical. Wait and retry when the twitter api rate limit is reached.

language

Character string. Language code of tweets to collect as two character ISO 639-1 code.

date_until

Character string. Date to collect tweets to in format "YYYY-MM-DD".

since_id

Numeric. Collect tweets with a tweet id more recent than since_id.

max_id

Numeric. Collect tweets with a tweet id older than max_id.

Value

A vosonSML twitter dataframe.


Collect youtube data

Description

This function is a wrapper for collecting youtube video comments using vosonSML::Collect.

Usage

collectYoutubeData(
  youtube_api_key,
  youtube_video_id_list,
  youtube_max_comments
)

Arguments

youtube_api_key

Character string. Youtube api key.

youtube_video_id_list

Character vector. Youtube video ids to collect comments from.

youtube_max_comments

Numeric. Maximum number of comments to collect.

Value

A vosonSML youtube dataframe.


Create a text corpus from graph text attribute data

Description

This function creates a text corpus from node or edge text attribute data in an igraph.

Usage

corpusFromGraph(
  g = NULL,
  txt_attr = NULL,
  type = "vertex",
  iconv = FALSE,
  html_decode = TRUE,
  rm_url = TRUE,
  rm_num = TRUE,
  rm_punct = TRUE,
  rm_twit_hashtags = FALSE,
  rm_twit_users = FALSE,
  sw_kind = "SMART",
  rm_words = NULL,
  stem = FALSE
)

Arguments

g

an igraph graph object.

txt_attr

Character string. Name of graph text attribute. Default is NULL.

type

Character string. Graph attribute type. Default is "vertex".

iconv

Logical. Use the iconv function to attempt UTF8 conversion. Default is FALSE.

html_decode

Logical. HTML decode text. Default is TRUE.

rm_url

Logical. Remove URL's. Default is TRUE.

rm_num

Logical. Remove numbers. Default is TRUE.

rm_punct

Logical. Remove punctuation. Default is TRUE.

rm_twit_hashtags

Logical. Remove twitter hashtags. Default is FALSE.

rm_twit_users

Logical. Remove twitter user names. Default is FALSE.

sw_kind

Character string. Stopword dictionary. Refer stopwords kind parameter. Default is "SMART".

rm_words

Character vector. User defined stopwords. Default is NULL.

stem

Logical. Apply word stemming. Default is FALSE.

Value

A tm text corpus object.


Create reddit actor networks

Description

This function is a wrapper for creating a reddit actor networks using vosonSML::Create.

Usage

createRedditActorNetwork(data)

Arguments

data

vosonSML reddit dataframe.

Value

Reddit actor networks as named list.


Create a reddit url to request thread comments

Description

This function creates a url from specified thread url that can be used to request the thread comments.

Usage

createRedditRequestUrl(url)

Arguments

url

Character string. Reddit thread url.

Value

Reddit API url as character string.


Create a twitter auth token id

Description

This function uses properties of the twitter credential object to create a unique token id.

Usage

createTokenId(cred)

Arguments

cred

vosonSML twitter credential object.

Value

A token id as character string.


Create twitter actor networks

Description

This function is a wrapper for creating a twitter actor networks using vosonSML::Create.

Usage

createTwitterActorNetwork(data)

Arguments

data

vosonSML twitter dataframe.

Value

Twitter actor networks as named list.


Create an auth token with twitter app dev keys

Description

This function is a wrapper for vosonSML::Authenticate with twitter app developer keys. The properties type and created are added to the credential object to assist with VOSONDash token management.

Usage

createTwitterDevToken(app_name, keys)

Arguments

app_name

Character string. Twitter app name.

keys

List. Named list of twitter app API keys.

Value

A vosonSML twitter credential object.


Create a auth token with twitter app consumer keys

Description

This function creates a vosonSML::Authenticate credential object with twitter app consumer keys and interactive web authorization. rtweet::create_token is used to create the access token and the properties type and created are added to the credential object to assist with VOSONDash token management.

Usage

createTwitterWebToken(app_name, keys)

Arguments

app_name

Character string. Twitter app name.

keys

List. Named list of twitter app API keys.

Value

A vosonSML twitter credential object.


Create youtube actor networks

Description

This function is a wrapper for creating a youtube actor networks using vosonSML::Create.

Usage

createYoutubeNetwork(data)

Arguments

data

vosonSML youtube dataframe.

Value

Youtube actor networks as named list.


Load the package included "Divided They Blog" network graph

Description

This is a convenience function to load the "DividedTheyBlog_40Alist_release.graphml" graph.

Usage

dtbGraph()

Value

An igraph graph object.

Examples

## Not run: 
# load the "Divided They Blog" network graph
g <- dtbGraph()

## End(Not run)


Load the package included "Enviro Activist Websites 2006" network graph

Description

This is a convenience function to load the "enviroActivistWebsites_2006.graphml" graph.

Usage

eawGraph()

Value

An igraph graph object.

Examples

## Not run: 
# load the "Enviro Activist Websites 2006" network graph
g <- eawGraph()

## End(Not run)


Create an empty plot with text

Description

This function creates an empty plot that can be used to display a text message. Intended to be used in a series of plots to indicate that an individual plot cannot be created for some reason and still maintain a plot aesthetic.

Usage

emptyPlotMessage(message = "No plot available.")

Arguments

message

Character string. Text message to centre on empty plot. Default text is "No plot available.".

Value

An empty plot with text message.


Get graph network metrics

Description

Function creates a vector of calculated network metrics for a graph.

Usage

getNetworkMetrics(g, component_type = "strong")

Arguments

g

igraph graph object.

component_type

Character string. Use strongly or weakly connected components by specifying "strong" or "weak". Ignored for undirected graphs. Default is "strong".

Value

Network metrics as named vector.


Get subreddit name from url

Description

This function extracts the subreddit name from a reddit thread url.

Usage

getRedditUrlSubreddit(url)

Arguments

url

Character string. Reddit thread url.

Value

Subreddit name as character string.


Get a reddit thread id from url

Description

This function extracts the thread id from a reddit thread url.

Usage

getRedditUrlThreadId(url)

Arguments

url

Character string. Reddit thread url.

Value

Reddit thread id as character string.


Check system fonts

Description

Looks up installed system fonts.

Usage

getSystemFontFamilies()

Value

Returns installed system font families.


Get the VOSONDash package version

Description

This function returns the version of the loaded VOSONDash package.

Usage

getVOSONDashVer()

Value

Package version character string.


Get a list of vertex category attribute names and values

Description

This function returns a list of graph vertex attribute names that match a category attribute prefix format and their unique values.

Usage

getVertexCategories(g, cat_prefix = "vosonCA_")

Arguments

g

igraph graph object.

cat_prefix

Character string. Category attribute prefix format to match. Default is "vosonCA_".

Value

A named list of vertex category attributes and values.

Examples

## Not run: 
# get a list of voson vertex categories and values
g <- loadPackageGraph("DividedTheyBlog_40Alist_release.graphml")

vcats <- getVertexCategories(g)

# vcats
# $Stance
# [1] "conservative" "liberal"  

## End(Not run)


Get the vosonSML package version

Description

This function returns the version of the loaded vosonSML package.

Usage

getVosonSMLVersion()

Value

Package version as character string.


Get a youtube video id from url

Description

This function extracts the youtube video id from a youtube video url.

Usage

getYoutubeVideoId(url)

Arguments

url

Character string. Youtube video url.

Value

Video id as character string.


Check if graph object has text attributes

Description

This function checks if a graph has either vertex or edge text attributes.

Usage

hasVosonTextData(g)

Arguments

g

igraph graph object.

Value

Result as logical.

Note

Uses the VOSON vertex and edge text attribute prefix "vosonTxt_" to determine if attributes are text attributes.


Check if macOS

Description

This function checks if running the macOS version of R.

Usage

isMac()

Value

Result as logical.


Check a value for a range of empty conditions

Description

This function checks a value is not NULL, NA or an empty string.

Usage

isNullOrEmpty(x)

Arguments

x

Input value.

Value

Result as logical.


Return logical if vosonSML version later than 0.29

Description

This function returns if the installed version of vosonSML is later than v0.29

Usage

isVosonSML0290()

Value

Logical.


Load package included network graph

Description

This function loads a network graph included in the extdata directory of the VOSONDash package by file name.

Usage

loadPackageGraph(fname)

Arguments

fname

Character string. Name of demonstration graphml file.

Value

An igraph graph object.

Examples

## Not run: 
# load the "Divided They Blog" package included network graph by file name
g <- loadPackageGraph("DividedTheyBlog_40Alist_release.graphml")

## End(Not run)


Add message to log queue

Description

This function adds a text message to a queue or list with a count limiting how many messages are stored. The queue stores count messages based on first in first out.

Usage

logMessage(messages, add_message, txt = FALSE, count = 20)

Arguments

messages

Character vector. Lines or text log messages.

add_message

Character string. Text log message to add to messages

txt

Logical. Return messages as single character string delimited by newline characters.

count

Numeric. Return queue of count messages and discard the rest.

Value

Messages as vector or character string.


Create a mixing matrix

Description

Function creates a mixing matrix by graph vertex attribute.

Usage

mixmat(g, attrib, use_density = TRUE)

Arguments

g

igraph graph object.

attrib

Character string. Vertex attribute or category.

use_density

Logical. Use edge density. Default is TRUE.

Value

A mixing matrix.

Note

Mixing matrix original function written by Gary Weissman. See: https://gist.github.com/gweissman/2402741.

Examples

## Not run: 
# create a mixing matrix of the demonstration network based on vertex 
# categorical attribute for political stance "vosonCA_Stance"
g <- loadPackageGraph("DividedTheyBlog_40Alist_release.graphml")

mm <- mixmat(g, "vosonCA_Stance", use_density = FALSE)

## End(Not run)


Run the VOSON Dashboard Shiny Application

Description

This function launches the VOSONDash Shiny app in the default web browser.

Usage

runVOSONDash(pkgStartupMsgs = FALSE, isLocal = NULL)

Arguments

pkgStartupMsgs

Logical. Display app package loading messages. Default is FALSE.

isLocal

Logical. Manually set app local or server mode flag.

Value

None


Create a file name with system date time prefix

Description

This function uses the system date and time to create a unique file name.

Usage

systemTimeFilename(name_suffix, name_ext, clean = FALSE)

Arguments

name_suffix

Character string. Name part of file name to append to date time part.

name_ext

Character string. File extension without the period. For example, "txt".

clean

Logical. Remove problematic file system characters from file name part. Default is FALSE.

Value

A unique date time file name as character string.


Create a wordcloud plot

Description

This function creates a wordcloud plot from word frequencies.

Usage

wordCloudPlot(
  word_freqs,
  seed = NULL,
  min_freq = 1,
  max_words = 50,
  pcolors = NULL,
  family = NULL,
  ...
)

Arguments

word_freqs

Table. Table of word frequencies.

seed

Numeric. Seed value can be supplied to reproduce a word cloud layout.

min_freq

Numeric. Minimum word frequency to include a word in the word cloud. Default is 1.

max_words

Numeric. Maximum number of words to render in the word cloud. Default is 50.

pcolors

List. Colors to assign categorical variable in the plot or palette to use if random.color. Default is NULL.

family

Character. Set a font family for plot labels. Default is NULL.

...

Arguments passed on to wordcloud::wordcloud

random.order

plot words in random order. If false, they will be plotted in decreasing frequency

random.color

choose colors randomly from the colors. If false, the color is chosen based on the frequency

rot.per

proportion words with 90 degree rotation

Value

A wordcloud plot.


Create a word frequency chart

Description

This function creates a horizontal barchart of word frequencies.

Usage

wordFreqChart(
  word_freqs,
  min_freq = 1,
  top_count = 20,
  pcolors = NULL,
  family = NULL
)

Arguments

word_freqs

Dataframe. Word frequencies.

min_freq

Numeric. Minimum frequency for a word to be included in the chart. Default is 1.

top_count

Numeric. Top count of words to render in word frequency chart. Default is 20.

pcolors

List. Colors to assign categorical variable in the plot. Default is NULL.

family

Character string. Set a font family for plot labels. Default is NULL.

Value

A barchart plot.


Create a word frequency dataframe

Description

Create a word frequency dataframe from a text corpus.

Usage

wordFreqFromCorpus(
  corp,
  rm_sparse = 0.99,
  word_len = c(3, 26),
  word_freq = c(1, Inf)
)

Arguments

corp

a tm text corpus object.

rm_sparse

Logical. Remove proportion of sparse terms. Default is 0.99.

word_len

Numeric vector. Min and max length of words to include. Default is c(3, 26).

word_freq

Numeric vector. Min and max frequency of words to include. Default is c(1, Inf).

Value

A data.table of word frequencies.


Create an NRC emotion chart

Description

This function creates a horizontal barchart measuring and sorting the eight NRC lexicon emotions. Emotions are measured as the proportion of the total value of the eight emotions in the text as a percentage.

Usage

wordSentChart(data, pcolors = NULL)

Arguments

data

Dataframe. NRC emotions table.

pcolors

List. Colors to assign categorical variable in the plot. Default is NULL.

Value

A barchart plot.

Note

Uses the syuzhet package implementation of Saif Mohammad’s NRC Emotion lexicon.


Create NRC emotion data

Description

This function creates an NRC emotion dataframe from a text corpus.

Usage

wordSentData(corp, word_len = c(3, 26))

Arguments

corp

tm package document Corpus object.

word_len

Numeric vector. Min and max length of words to include. Default is c(3, 26).

Value

An NRC sentiment dataframe.

Note

Uses the syuzhet package implementation of Saif Mohammad’s NRC emotion lexicon.


Create an NRC sentiment valence chart

Description

This function creates a vertical barchart of the sum of negative and positive sentiments, and the valence or net sentiment in a text corpus.

Usage

wordSentValenceChart(data)

Arguments

data

Dataframe. NRC emotions table.

Value

A barchart plot.

mirror server hosted at Truenetwork, Russian Federation.