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
#include <Rembedded.h> | |
#include <Rdefines.h> | |
static void doSplinesExample(); | |
int | |
main(int argc, char *argv[]) | |
{ | |
Rf_initEmbeddedR(argc, argv); | |
doSplinesExample(); | |
Rf_endEmbeddedR(0); |
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
set.seed(1234) | |
junk <- biospear::simdata(n=500, p=500, q.main = 10, q.inter = 10, | |
prob.tt = .5, m0=1, alpha.tt= -.5, | |
beta.main= -.5, beta.inter= -.5, b.corr = .7, b.corr.by=25, | |
wei.shape = 1, recr=3, fu=2, timefactor=1) | |
## Method 1: MASS::mvrnorm() | |
## This is simdata() has used. It gives different numbers on different OS. | |
## | |
library(MASS) | |
set.seed(1234) |
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(glmnet) | |
# Binary data | |
n = 1000 | |
p = 100 | |
nzc = trunc(p/10) | |
for(i in 1:100) { | |
cat(i, " ") | |
if (i %% 10 == 0) cat("\n") | |
x = matrix(rnorm(n * p), n, p) |
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
x <- read.delim("GX_datab31.txt") | |
dim(x) | |
# [1] 1579 463 | |
sum(x) | |
sum(x[1, ]) | |
options(digits = 20) | |
sum(x) | |
# [1] 12589441.434223400429 | |
sum(x[1,]) | |
# [1] 4787.087760000000344 |
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
# This is a note about import rsem-generated file for DESeq2 package | |
# As described by the tximport's vignette, the method below uses the gene-level estimated counts from the quantification tools, and additionally to use the transcript-level abundance estimates to calculate a gene-level offset that corrects for changes to the average transcript length across samples. | |
# This approach corrects for potential changes in gene length across samples (e.g. from differential isoform usage) | |
# References: | |
# 1. http://bioconductor.org/packages/release/bioc/vignettes/tximport/inst/doc/tximport.html#rsem | |
# 2. https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#differential-expression-analysis | |
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
# Optional parameters for the console and the pager | |
# The system-wide copy is in rwxxxx/etc. | |
# A user copy can be installed in `R_USER'. | |
## Style | |
# This can be `yes' (for MDI) or `no' (for SDI). | |
MDI = yes | |
# the next two are only relevant for MDI | |
toolbar = yes | |
statusbar = no |
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
# https://aschinchon.wordpress.com/2014/03/13/the-lonely-acacia-is-rocked-by-the-wind-of-the-african-night/ | |
depth <- 9 | |
angle<-30 #Between branches division | |
L <- 0.90 #Decreasing rate of branches by depth | |
nstars <- 300 #Number of stars to draw | |
mstars <- matrix(runif(2*nstars), ncol=2) | |
branches <- rbind(c(1,0,0,abs(jitter(0)),1,jitter(5, amount = 5)), data.frame()) | |
colnames(branches) <- c("depth", "x1", "y1", "x2", "y2", "inertia") | |
for(i in 1:depth) | |
{ |
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
### Random pattern | |
# Create matrix with random values with dimension of final grid | |
rand <- rnorm(441, mean=0.3, sd=0.1) | |
mat.rand <- matrix(rand, nrow=21) | |
# Create another matrix for the colors. Start by making all cells green | |
fill <- matrix("green3", nr = 21, nc = 21) | |
# Change colors in each cell based on corresponding mat.rand value | |
fcol <- fill |
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
# http://blogs.sas.com/content/iml/2012/12/14/a-fractal-christmas-tree/ | |
# Each row is a 2x2 linear transformation | |
# Christmas tree | |
L <- matrix( | |
c(0.03, 0, 0 , 0.1, | |
0.85, 0.00, 0.00, 0.85, | |
0.8, 0.00, 0.00, 0.8, | |
0.2, -0.08, 0.15, 0.22, | |
-0.2, 0.08, 0.15, 0.22, | |
0.25, -0.1, 0.12, 0.25, |
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
## ====================================================================== | |
## Step 1: Download all log files | |
## ====================================================================== | |
# Here's an easy way to get all the URLs in R | |
start <- as.Date('2018-07-01') | |
today <- as.Date('2018-12-31') | |
all_days <- seq(start, today, by = 'day') | |