Allocation cost

17 September 2017

Many high-level programming languages allow their users to afford the luxury of extending an existing matrix or vector. The question is, how luxury it can be?

data.table subsetting

02 March 2017

The data.table package supports a powerful syntax to select rows and columns.

Non-trivial operation on data.table columns

01 March 2017

This note explores the use of data.table package to calculate pairwise correlation between columns, with iris data set as example.

Expectation of trials until success

11 September 2016

Example 1 - Fair coin

28 August 2016

Maximum likelihood fitting a discrete variable distribution

07 July 2016

The package MASS provides a function, fitdistr to fit an observation over discrete distribution using Maximum likelihood.

String manipulation efficiency

07 July 2016

String concatenation can be done with paste, paste0, sprintf, or .Internal(sprintf).

How much harm can nested if's do?

07 July 2016

The definition of a(), b(), and sw() below achieve the same effect with different implementations: if else, nested if, and switch

.Internal(sample)

07 July 2016

.Internal(sample()) requires explicitly 4 arguments in order: n, size, replacement, probabilities

30 June 2016

Two-class

Fast Pearson Correlation

27 June 2016

This note compares the performance of 2 methods for calculating Pearson correlation: R stats::cor function WGCNA::cor function (or corFast)

Plotting large matrix in R

09 April 2016

a = matrix(rnorm(10000^2),ncol=10000) Ns = c(1000, 5000,10000) times = data.frame(list(N=Ns)) t1 = sapply(Ns, function(n) {system.time(image(a[1:n,1:n],useRaster=T))['elapsed']})

kNN estimator in action

24 March 2016

-nearest neighbor Entropy estimator

18 March 2016

The inconsistency

Kernel density estimator

10 March 2016

See Lecture by [@gutierrez_kernel].

23 February 2016

Recursive indexing failed

18 February 2016

An example where recursive indexing failed error is not clear

Digit count

22 January 2016

Recursive function

apply() function

22 January 2016

Data This is the value of matrix a