Skip to main content

Posts

Showing posts from February, 2017

C++ with R on Mac OS

It sometimes could be a great idea to incorporate bits of C++ into our R coding through the Rcpp package. Before writing or calling our C++ functions, we need firstly a working C++ setup for R, which is not difficult on Mac OS system. First, we need a C++ compiler. We can download XCode and install the Command Line Tools. Second, we need to create a file  $\sim$/.R/Makevars , to tell R which compliers to use. The file creation can be done by typing the following commands in Terminal, cd ~/.R nano Makevars Now add the following text: CC = clang CXX = clang++ And follow the directions at the bottom of the screen to "write out" and close the file (Control-O Enter and Control-X). Next, we need to install Rcpp package in R from source so that it is built with the same C++ complier we are using. install.packages("Rcpp", type = "source") After finishing the setup of connection between C++ and R, we can write a C++ function that R c...

How to insert math symbols & formulas by Latex on Blogger

In order to insert math symbols & formulas by Latex on Blogger, just drop in <script type = "text/javascript" src = "http://cdn.mathjax.org/mathjax/latest/MathJax.js" > MathJax . Hub . Config ({ extensions : [ "tex2jax.js" , "TeX/AMSmath.js" , "TeX/AMSsymbols.js" ], jax : [ "input/TeX" , "output/HTML-CSS" ], tex2jax : { inlineMath : [ [ '$' , '$' ], [ "\\(" , "\\)" ] ], displayMath : [ [ '$$' , '$$' ], [ "\\[" , "\\]" ] ], }, "HTML-CSS" : { availableFonts : [ "TeX" ] } }); </script> after the header ( <head> ) in the Blogger template.