Category Archives: programming

The Rcpp package test notes

Test Environment: OS: Windows XP, R: R 2.12.2(G:\Program Files\R\R-2.12.2\), Rcpp: 0.9.4 1. Download and install the Rtools(for windows): http://www.murdoch-sutherland.com/Rtools/ I installed the Rtools into “G:\Rtools“. 2. Set Enviroment Path for windows: Desktop -> right-click My Computer -> click Properties -> … Continue reading

Posted in programming, r | 1 Comment

R Tricks – Macros and Conditional Execution in R

1 Use Macros in R Problem You want to use C-like macros, such as “#define” in R. Solution Use “defmacro” in {gtools} pacakge. http://cran.r-project.org/web/packages/gtools/index.html https://stat.ethz.ch/pipermail/r-help/2007-April/130015.html 2 Conditional Execution Problem You want to use C-like macros, such as “#include” and C-like … Continue reading

Posted in programming, r | Leave a comment

Why the point probability of a continuous distribution is 0?

We all know that if a random variable is continuous distributed, the point probability of is 0. For example, , where means a uniform distribution with support in . Then for any . However, it is not that easy to understand why . The  confusion always comes from … Continue reading

Posted in probability, programming | Leave a comment