This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################################ | |
############################################################################################ | |
# Plotting networks in R - an example how to plot a network and | |
# customize its appearance using networkD3 library | |
############################################################################################ | |
############################################################################################ | |
# Clear workspace | |
# rm(list = ls()) | |
############################################################################################ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################################ | |
############################################################################################ | |
# Plotting networks in R - an example how to plot a network and | |
# customize its appearance in Cytoscape directly from R using | |
# the RCy3 package | |
############################################################################################ | |
############################################################################################ | |
# Clear workspace | |
# rm(list = ls()) | |
############################################################################################ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using eval to create a function that will be able to produce a data summary (using the plyr::ddply function) | |
# based on the user specified data frame, variables (that correspond to table column names) over which they | |
# want to split and summarize the data (character vector), and a two-column table (data frame) which contains | |
# the user specified name of the function used for summary (first column) and the function used for summary (second column) | |
# | |
# For more info, see http://www.vesnam.com/Rblog/one-function-to-run-them-all/ | |
# | |
# Data, variable, and formulas used for data summary | |
ex1_df <- datasets::mtcars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("igraph") | |
rm(list = ls()) | |
########################################################################## | |
# Read data | |
dataSet <- read.table("lesmis.txt", header = FALSE, sep = "\t") | |
# Create a graph. Use simplify to ensure that there are no duplicated edges or self loops | |
gD <- simplify(graph.data.frame(dataSet, directed=FALSE)) | |
# Calculate degree for all nodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("igraph") | |
library("plyr") | |
library("HiveR") | |
library("RColorBrewer") | |
############################################################################################ | |
rm(list = ls()) | |
dataSet <- read.table("lesmis.txt", header = FALSE, sep = "\t") | |
############################################################################################ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod.adj2HPD <- function (M = NULL, axis.cols = NULL, type = "2D", desc = NULL) | |
{ | |
if (is.null(M)) | |
stop("No adjacency matrix provided") | |
if (is.null(dimnames(M))) | |
stop("Adjacency matrix must have named dimensions") | |
lab1 <- unlist(dimnames(M)[1]) | |
lab1 <- as.character(lab1) | |
lab2 <- unlist(dimnames(M)[2]) | |
lab2 <- as.character(lab2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plotting networks in R | |
# An example how to use R and rgexf package to create a .gexf file for network visualization in Gephi | |
############################################################################################ | |
# Clear workspace | |
rm(list = ls()) | |
# Load libraries | |
library("igraph") | |
library("plyr") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plotting networks in R | |
# An example how to plot networks and customize their appearance in Cytoscape directly from R, using RCytoscape package | |
############################################################################################ | |
# Clear workspace | |
rm(list = ls()) | |
# Load libraries | |
library("igraph") | |
library("plyr") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Read .mp3 files from a given directory, compare songs, and play them in order of similarity | |
library("plyr") | |
library("tuneR") | |
library("seewave") | |
library("compiler") | |
library("foreach") | |
library("doMC") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("tuneR") | |
transcribeMusic <- function(wavFile, widthSample = 4096, expNotes = NULL) | |
{ | |
#See details about the wavFile, plot it, and/or play it | |
#summary(wavFile) | |
plot(wavFile) | |
#play(wavFile, "/usr/bin/mplayer") | |
perioWav <- periodogram(wavFile, width = widthSample) |
NewerOlder