Title: | Analyze Group Patterns using Graph Theory in Educational Settings |
---|---|
Description: | Analyzes group patterns using discourse analysis data with graph theory mathematics. Takes the order of which individuals talk and converts it to a network edge and weight list. Returns the density, centrality, centralization, and subgroup information for each group. Based on the analytical framework laid out in Chai et al. (2019) <doi:10.1187/cbe.18-11-0222>. |
Authors: | Albert Chai [aut], Andrew Lee [aut], Joshua Le [aut], Katherine Ly [ctb], Kevin Banh [ctb], Priya Pahal [ctb], Jitarth Sheth [aut], Qi Cui [aut, cre], Stanley Lo [aut] |
Maintainer: | Qi Cui <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.2.0 |
Built: | 2025-02-22 04:11:02 UTC |
Source: | https://github.com/q1cui/discoursegt |
A data set that sample attribute data to complement Sample Data 1. This data was randomly generated. This data set is for students who are currently taking a STEM course at a major university. 4 students are in this sample study.
attributeData
attributeData
A data frame of 4 rows with 12 variables
Student identifier in the group
Gender of student
Ethnicity of student
Current overall GPA of student
If the student is a first generation standing
If student is in a STEM major
Major of the student
Reasons to why student is taking the course
Current class standing at the university
Number of prior AP courses taken
Current residency of the student
SAT score for admission
...
Plots the graph using the base plot function. To map attributes on the graph use plot1Att
for 1 attribute or plot2Att
for 2 attributes.
basicPlot( ginp, graph_selection_input = 0, curvedEdgeLines = TRUE, arrowSizeMultiplier = 1, scaledEdgeLines = FALSE, scaledMin = NULL, scaledMax = NULL )
basicPlot( ginp, graph_selection_input = 0, curvedEdgeLines = TRUE, arrowSizeMultiplier = 1, scaledEdgeLines = FALSE, scaledMin = NULL, scaledMax = NULL )
ginp |
The prepared graph object from prepareGraphs function |
graph_selection_input |
The type of graphical projection to be used. Default projection is 0 (Fruchterman Reingold). Selection must be a numeric option from 0-2. Other options include: 1 = Kamada Kawai, 2 = Reingold Tilford |
curvedEdgeLines |
Whether or not the edges between nodes should be curved or straight. Default is curved lines. |
arrowSizeMultiplier |
Adjusts the default arrow size based on a multiplier. Default value is 1. |
scaledEdgeLines |
Whether or not the edges of the graph should be scaled |
scaledMin |
If scaledEdgeLines = TRUE, then what the lightest weight should be scaled to |
scaledMax |
If scaledEdgeLines = TRUE, then what the heaviest weight should be scaled to |
Returns graphical plot to disk, if selected, or to R console
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) #Plot the graph basicPlot(baseNet)
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) #Plot the graph basicPlot(baseNet)
Analyzes the graphs with the core parameters, such as number of edges and nodes, density, average degree, centrality, and modularity
coreNetAnalysis(ginp)
coreNetAnalysis(ginp)
ginp |
The prepared graph object from prepareGraphs function |
Gives the edge and weighted edge counts, number of nodes, density, degree (averages), memberships, modularity, centrality, articulation points, and strong/weak plots as a list object
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) coreNetAnalysis(baseNet)
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) coreNetAnalysis(baseNet)
Takes raw input that is in a 2 column format/question-and-response format and generates an appropriate edge lists in a combined .csv file.
edgelist_raw(input_file)
edgelist_raw(input_file)
input_file |
Source of the raw input file. Must be in a .csv format |
Saves the weight and edge lists as a data.frame object or a .csv file to disk.
df <- sampleData1 prepNet <- edgelist_raw(df)
df <- sampleData1 prepNet <- edgelist_raw(df)
Plots graph data using the GGally library and ggnet function while incorporating demographic properties. Use this plot function if you have all demographic data available to plot.
plot1Att( data, prop = 20, graphmode = "fruchtermanreingold", attribute = NULL, attribute.label = NULL, attribute.node.labels = NULL, attribute.nodesize = 10 )
plot1Att( data, prop = 20, graphmode = "fruchtermanreingold", attribute = NULL, attribute.label = NULL, attribute.node.labels = NULL, attribute.nodesize = 10 )
data |
Data from the prepareGraphs function |
prop |
Rescaling the graph edge sizes for the plot |
graphmode |
Type of graphical projection to use. Default is Fruchterman Reingold. Refer to gplot.layout for the various available options |
attribute |
Mapping to the attribute information, can be list or column in data frame |
attribute.label |
Name of the attribute info (Required) |
attribute.node.labels |
Mapping to the node labels, can be list or column in data frame |
attribute.nodesize |
Size of the nodes. Default will result in size of 10. Can be replaced with custom mapping in list or column in data frame. (Required) |
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) attdata <- attributeData plot1Att(baseNet, prop = 20, graphmode = "fruchtermanreingold", attribute = attdata$gender, attribute.label = "Gender", attribute.node.labels = attdata$node, attribute.nodesize = 12)
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) attdata <- attributeData plot1Att(baseNet, prop = 20, graphmode = "fruchtermanreingold", attribute = attdata$gender, attribute.label = "Gender", attribute.node.labels = attdata$node, attribute.nodesize = 12)
Plots graph data using the GGally library and ggnet function while incorporating demographic properties. Use this plot function if you have all demographic data available to plot.
plot2Att( data, prop = 20, graphmode = "fruchtermanreingold", attribute1 = NULL, attribute2 = NULL, attribute1.label = "Attribute 1", attribute2.label = "Attribute 2", attribute.node.labels = NULL, attribute.nodesize = 10 )
plot2Att( data, prop = 20, graphmode = "fruchtermanreingold", attribute1 = NULL, attribute2 = NULL, attribute1.label = "Attribute 1", attribute2.label = "Attribute 2", attribute.node.labels = NULL, attribute.nodesize = 10 )
data |
Data from the prepareGraphs function |
prop |
Rescaling the graph edge sizes for the plot |
graphmode |
Type of graphical projection to use. Default is Fruchterman Reingold. Refer to gplot.layout for the various available options |
attribute1 |
Mapping to the attribute 1 information, can be list or column in data frame (Required) |
attribute2 |
Mapping to the attribute 2 information, can be list or column in data frame (Required) |
attribute1.label |
Name of the attribute 1 info (Required) |
attribute2.label |
Name of the attribute 2 info (Required) |
attribute.node.labels |
Mapping to the node labels, can be list or column in data frame (Required) |
attribute.nodesize |
Size of the nodes. Default will result in size of 10. Can be replaced with custom mapping in list or column in data frame. (Required) |
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) attdata <- attributeData plot2Att(baseNet, prop = 20, graphmode = "fruchtermanreingold", attribute1 = attdata$gender, attribute2 = attdata$ethnicity, attribute1.label = "Gender", attribute2.label = "Ethnicity", attribute.node.labels = attdata$node, attribute.nodesize = 12)
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) attdata <- attributeData plot2Att(baseNet, prop = 20, graphmode = "fruchtermanreingold", attribute1 = attdata$gender, attribute2 = attdata$ethnicity, attribute1.label = "Gender", attribute2.label = "Ethnicity", attribute.node.labels = attdata$node, attribute.nodesize = 12)
Creates plots for non-graph theory parameters for episode lengths, questions per hour versus responses per hour, and normalized turn ratio
plotNGTData(data, convoMinutes, silentNodes = 0)
plotNGTData(data, convoMinutes, silentNodes = 0)
data |
Original raw input data in ordered question/response 2 column format |
convoMinutes |
Time length of the conversation in the graph in minutes |
silentNodes |
The number of nodes that do not interact with other nodes but are in the group |
Creates a plot returning the questions per hour versus responses per hour, frequency plot of the number of episodes, and normalized turn ratio
df <- sampleData1 plotNGTData(df, convoMinutes = 60, silentNodes = 0)
df <- sampleData1 plotNGTData(df, convoMinutes = 60, silentNodes = 0)
Prepares the graphical object from the prepared edge and weight list data frame
prepareGraphs(raw_data_input, project_title = "", weightedGraph = TRUE)
prepareGraphs(raw_data_input, project_title = "", weightedGraph = TRUE)
raw_data_input |
The raw edge and weight list processed from the tabulate_edges() function. |
project_title |
The title of the project. |
weightedGraph |
Graph will add weights to the edges to a set of nodes based on the weight specified on the list. Default allows for weights on the graph. |
Stores the igraph graph object, graph adjacency matrix, edge and weight lists, project title, and a user option for weighted to list object.
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE)
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE)
A data set that contains Episode Start (in this case, questions) and Episode Contination (in this case, responses) data in a 2 column format. This data was randomly generated. Case basis: 4 students in a group discussion questions in a STEM course at a major university.
sampleData1
sampleData1
A data frame with 466 rows and 2 variables:
If participant in the graph has initiated an episode
If participant in the graph has raised a response to the previous episode
...
Performs a subgroup analysis on the graph
subgroupsNetAnalysis(ginp, raw_input = NULL, normalized = FALSE)
subgroupsNetAnalysis(ginp, raw_input = NULL, normalized = FALSE)
ginp |
The prepared graph object from prepareGraphs function |
raw_input |
The data of the original .csv file |
normalized |
Normalize the betweeness centrality values |
Saves number of potential cliques, cores, symmetry of the graph, dyads in graphs, node composition in proposed cliques, neighbors adjacent to each node, transitivity (local and global) as a list object
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) subgroupsNetAnalysis(baseNet, raw_input = df)
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) subgroupsNetAnalysis(baseNet, raw_input = df)
Returns a summary of the processed graph results on console. The initial graph configuration and core analysis is required for this function to work. The other components are optional due to the modular nature of the functions. Data must be stored as a data object.
summaryNet( netintconfigData = NULL, coreNetAnalysisData = NULL, subgroupsNetAnalysisData = NULL, display = FALSE )
summaryNet( netintconfigData = NULL, coreNetAnalysisData = NULL, subgroupsNetAnalysisData = NULL, display = FALSE )
netintconfigData |
Data object where the graph configuration data is stored (from |
coreNetAnalysisData |
Data object where the core analysis data is stored (from |
subgroupsNetAnalysisData |
Data object where subgroup analysis data is stored (from |
display |
Should the output be displayed in the R console? Results are saved as the project name in the initial config data as a text file on disk. |
Prints organized summary of all results of the graph with modular components on console or to .txt file on disk.
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) prepGraphs <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) coreNet <- coreNetAnalysis(prepGraphs) subgroup <- subgroupsNetAnalysis(prepGraphs, raw_input = df) summaryNet(netintconfigData = prepGraphs, coreNetAnalysisData = coreNet, subgroupsNetAnalysisData = subgroup, display = TRUE)
df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) prepGraphs <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) coreNet <- coreNetAnalysis(prepGraphs) subgroup <- subgroupsNetAnalysis(prepGraphs, raw_input = df) summaryNet(netintconfigData = prepGraphs, coreNetAnalysisData = coreNet, subgroupsNetAnalysisData = subgroup, display = TRUE)
Takes raw input that is in a 2 column format/question-and-response format and generates an appropriate edge and weight lists in a combined .csv file. The weights in this function are determined by the number of occurrences a specific edge has occurred in the graph
tabulate_edges(input, silentNodes = 0)
tabulate_edges(input, silentNodes = 0)
input |
Input in question-and-response format. Must be a data.frame or file name of a .csv |
silentNodes |
The number of nodes that do not interact with other nodes but are in the group |
Saves the weight and edge lists as a data.frame object or a .csv file to disk.
df <- sampleData1 tabData <- tabulate_edges(df, silentNodes = 0)
df <- sampleData1 tabData <- tabulate_edges(df, silentNodes = 0)
Saves information from graphs and data objects created by package. Plots are saved as .tiff at 300 dpi
writeData(project_name, objectfile, dirpath = NULL)
writeData(project_name, objectfile, dirpath = NULL)
project_name |
Name of the project |
objectfile |
The saved data object data file |
dirpath |
The working directory that the files will be saved to. Path required for write function to work. Current directory, use "." as the dirpath |
Saves the requested object file to disk. Saves graphs or summary information sheets.
attributeData <- attributeData df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) NetPlots2 <- plot2Att(baseNet, attribute1 = attributeData$ethnicity, attribute2 = attributeData$gender, attribute.node.labels = attributeData$node, attribute1.label = "Ethnicity", attribute2.label = "Gender") writeData("Sample Data 1", NetPlots2, dirpath = tempdir())
attributeData <- attributeData df <- sampleData1 prepNet <- tabulate_edges(df, silentNodes = 0) baseNet <- prepareGraphs(prepNet, project_title = "Sample Data 1", weightedGraph = TRUE) NetPlots2 <- plot2Att(baseNet, attribute1 = attributeData$ethnicity, attribute2 = attributeData$gender, attribute.node.labels = attributeData$node, attribute1.label = "Ethnicity", attribute2.label = "Gender") writeData("Sample Data 1", NetPlots2, dirpath = tempdir())