[R] Writing own simulation function in C

TheSavageSam jujokopr at jyu.fi
Fri Mar 5 22:54:48 CET 2010


I am wishing to write my own random distribution simulation function using C
programmin language(for speed) via R. I am familiar with R programming but
somewhat new to C programming. I was trying to understand "Writing R
extensions" -guide and its part 6.16, but I found it hard to
understand(http://cran.r-project.org/doc/manuals/R-exts.html#Standalone-Mathlib).
I also tried to get familiar with the example codes, but it didn't make me
any wiser.

The biggest problem seems to be how to get(what code to write in C) random
uniform numbers using Rmath. That seems to be too complicated to me at the
moment. So if someone of you could give a small example and it would
definitely help me a lot. All I wish to do first is to finally write(and
understand) my own function similar to what you run in R Command line via
command "runif".

And all this I am hoping to do without recompiling my whole R. Instead of
that I think that it is possible to use dyn.load("code.so") in R. (Yes, I
use linux)
-- 
View this message in context: http://n4.nabble.com/Writing-own-simulation-function-in-C-tp1580190p1580190.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list