This file contains hidden or 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
shinyServer(function(input,output){ | |
mydat <- reactive(function() { | |
scale(rsnorm(input$obs, location = input$mean, scale =input$variance, | |
shape = input$skew),center=TRUE,scale=TRUE) | |
}) | |
ndat <- reactive(function() { | |
scale(rnorm(input$obs, mean = input$mean, sd =input$variance),center=TRUE, scale=TRUE) | |
}) | |
This file contains hidden or 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
#demonstration of data summary tools | |
#enable necessary functions | |
source("http://pastebin.com/raw.php?i=JVyTrYRD") | |
#get demo data | |
library(RCurl) | |
url<-getURL("https://docs.google.com/spreadsheet/pub?key=0Ap1AEMfo-fh9dGFHRk81cVJaMTIxUjQzSlo2RS1RZXc&single=true&gid=0&output=csv",ssl.verifypeer = FALSE) | |
tmp.data<-read.csv(textConnection(url)) | |
#Prepare to generate data summaries and conduct statitcal tests |
This file contains hidden or 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
#------------------------------------------------------ | |
# demonstration of making edge lists for | |
# correlation network analysis | |
# by Dmitry Grapov | |
# 031814 | |
#------------------------------------------------------ | |
# load devium library for all functions | |
source("http://pastebin.com/raw.php?i=JVyTrYRD") # sources function to download github repo (https://github.com/dgrapov/devium) |
This file contains hidden or 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
Name KEGG id | |
Carnitine C00318 | |
catechin C06562 | |
threonine C00188 | |
threonic acid C01620 | |
phenylethylamine C05332 | |
phenylalanine C00079 | |
N-acetyl-L-ornithine C00437 | |
mannitol C00392 | |
glutathione C00051 |
This file contains hidden or 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
sourceName sourceKEGG sourceCID targetName targetKEGG targetCID indirect | |
arachidonic_acid C00219 444899 TXB2 C05963 5283137 y | |
arachidonic_acid C00219 444899 PGE2 C00584 5280360 y | |
arachidonic_acid C00219 444899 LTB4 C02165 5280492 y | |
linoleic_acid C01595 5280450 9,10,13-TriHOME C14835 5282965 y | |
linoleic_acid C01595 5280450 9,12,13-TriHOME C14833 9858729 y | |
linoleic_acid C01595 5280450 EKODE 5283007 y | |
arachidonic_acid C00219 444899 11(12)-EpETrE 53480479 n | |
arachidonic_acid C00219 444899 11-HETE C14780 5283168 n | |
arachidonic_acid C00219 444899 12-HETE C14777 5283155 n |
This file contains hidden or 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
--- | |
title: "Hands-on with dplyr" | |
author: "Dmitry Grapov" | |
output: | |
html_document: | |
keep_md: yes | |
--- | |
## Introduction |
This file contains hidden or 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(shiny) | |
library(ggvis) | |
shinyApp( | |
ui =bootstrapPage( | |
actionButton("randomize", "Randomize"), | |
ggvisOutput("plot1"), | |
ggvisOutput("plot2"), | |
verbatimTextOutput("summary") | |
), |
This file contains hidden or 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
#R code, testing RECA with the iris data | |
library(RECA) | |
#test data | |
data(iris) | |
x<-iris[,-5] | |
y<-iris$Species | |
#similar groups (species) in each chunk (n=3) | |
chunksvec<-as.numeric(y) |
This file contains hidden or 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(reshape2) | |
gen.mat.to.edge.list<-function(mat,symmetric=TRUE,diagonal=FALSE,text=FALSE){ | |
#create edge list from matrix | |
# if symmetric duplicates are removed | |
mat<-as.matrix(mat) | |
id<-is.na(mat) # used to allow missing | |
mat[id]<-"nna" | |
if(symmetric){mat[lower.tri(mat)]<-"na"} # use to allow missing values | |
if(!diagonal){diag(mat)<-"na"} |
This file contains hidden or 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
#SOM example using wines data set | |
library(kohonen) | |
data(wines) | |
set.seed(7) | |
#create SOM grid | |
sommap <- som(scale(wines), grid = somgrid(2, 2, "hexagonal")) | |
## use hierarchical clustering to cluster the codebook vectors | |
groups<-3 |