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
# Note: using the devel versions of both packages! | |
library(DESeq) # version 1.9.11 | |
library(edgeR) # version 2.99.8 | |
library(VennDiagram) | |
# Read in data ------------------------------------------------------------ | |
## Use pasilla data | |
datafile = system.file( "extdata/pasilla_gene_counts.tsv", package="pasilla" ) | |
datafile |
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
# A simple approach to visually-weighted regression plots | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("ggplot2", "reshape2", "MASS") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Generate some data: | |
nn <- 1000 | |
myData <- data.frame(X = rnorm(nn), |
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
# Simple ggplot2 heatmap | |
# with colorBrewer "spectral" palette | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("ggplot2", "reshape2", "RColorBrewer") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Generate a random matrix | |
# This can be any type of numeric matrix, |
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
# Randomly allocating observations into groups, for, e.g. cross-validation | |
kk <- 10 # Number of partitions, as in "kk-fold cross-validation." | |
# Here is a data.frame full of good data: | |
nn <- 1003 | |
myData <- data.frame(matrix(rnorm(nn * 3), ncol = 3)) | |
colnames(myData) <- LETTERS[1:3] | |
# This does not work: | |
whichK <- sample(LETTERS[1:kk], nrow(myData), replace = 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
#' Constructor | |
EmailClass <- function(name, email) { | |
nc = list( | |
name = name, | |
email = email, | |
get = function(x) nc[[x]], | |
set = function(x, value) nc[[x]] <<- value, | |
props = list(), | |
history = list(), | |
getHistory = function() return(nc$history), |
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
# Simple ggplot2 heatmap, with optimal seriation | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("ggplot2", "reshape2", "RColorBrewer", "seriation") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Using U.S. Judge Rating Data | |
myData <- as.matrix(USJudgeRatings) |
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
heatmap.3=function (x, Rowv = TRUE, Colv = if (symm) "Rowv" else TRUE, | |
distfun = dist, hclustfun = hclust, dendrogram = c("both", | |
"row", "column", "none"), symm = FALSE, scale = c("none", | |
"row", "column"), na.rm = TRUE, revC = identical(Colv, | |
"Rowv"), add.expr, breaks, symbreaks = max(x < 0, na.rm = TRUE) || | |
scale != "none", col = "heat.colors", colsep, rowsep, | |
sepcolor = "white", sepwidth = c(0.05, 0.05), cellnote, notecex = 1, | |
notecol = "cyan", na.color = par("bg"), trace = c("column", | |
"row", "both", "none"), tracecol = "cyan", hline = median(breaks), | |
vline = median(breaks), linecol = tracecol, margins = c(5, |
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
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("ReadImages", "reshape", "ggplot2") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Image URL: | |
allImageURLs <- c("http://media.charlesleifer.com/blog/photos/thumbnails/akira_940x700.jpg", | |
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/402px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg", | |
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Official_portrait_of_Barack_Obama.jpg/441px-Official_portrait_of_Barack_Obama.jpg", | |
"http://cache.boston.com/universal/site_graphics/blogs/bigpicture/obama_11_05/obama22_16604051.jpg", |
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
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("ReadImages", "reshape", "ggplot2") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Image URL: | |
allImageURLs <- c("http://media.charlesleifer.com/blog/photos/thumbnails/akira_940x700.jpg", | |
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/402px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg", | |
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Official_portrait_of_Barack_Obama.jpg/441px-Official_portrait_of_Barack_Obama.jpg", | |
"http://cache.boston.com/universal/site_graphics/blogs/bigpicture/obama_11_05/obama22_16604051.jpg", |
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(sqldf) | |
sqldf("SELECT | |
day | |
, avg(temp) as avg_temp | |
FROM beaver2 | |
GROUP BY | |
day;") | |
# day avg_temp |
OlderNewer