R-Scripts for various purposes:

Please also visit my R focused blog Rmazing !!

bigcor
Create LARGE correlation/covariance matrices by "all combinations-blockwise correlation" (patch-wise filling of submatrices). More details can be found here.

MAT <- matrix(rnorm(21796 * 28), nrow = 28)
res <- bigcor(MAT, size = 2000, fun = "cor")

cbind.na
Combine data of unequal row length avoiding repetition or errors by filling with NAs. In contrast to classical cbind, cbind.na can be used to combine data such as

cbind.na(1:10, 1:3)

x <- matrix(rnorm(20), nrow = 10)
y <- matrix(rnorm(20), nrow = 5)
cbind.na(x, y)

rbind.na
Combine data of unequal column length avoiding repetition or errors by filling with NAs. In contrast to classical rbind, rbind.na can be used to combine data such as

rbind.na(1:10, 1:3)

x <- matrix(rnorm(20), nrow = 10)
y <- matrix(rnorm(20), nrow = 5)
rbind.na(x, y)

data.frame.na
Create a dataframe with variables of unequal length avoiding repetition or errors by filling with NAs. In contrast to classical data.frame, data.frame.na can be used to create dataframes such as

data.frame.na(x = 1:10, y = 1:5)
data.frame.na(x = 1:10, y = 1:3, z = letters[1:5])

counter
A simple counter which can be included in a loop to display the iterations.

for (i in 1:1000) counter(i)

delete
A simple function to delete elements from a vector with the option of filling in with NAs to original length.

delete(1:10, 5:7, fill = TRUE)

rescale
A function to rescale a vector of data wthin a new lower/upper bound, usually [0, 1].

rescale(rnorm(100), 0, 1)

xyy.plot
A two-ordinate plot (x-y1-y2) with the option to tweak the two ordinates separately by parameter y1.par and y2.par.

xyy.plot(1:10, rnorm(10, 5, 1), rnorm(10, 50, 1), y1.par = list(pch = 16), y2.par = list(pch = 15, las = 1))

peakarea
Calculation of peak areas from x-y (i.e. time versus fluorescence) trace data using Simpson's rule for numerical integration.