similar to: using R API in dynamically loaded code?

Displaying 20 results from an estimated 6000 matches similar to: "using R API in dynamically loaded code?"

1999 Nov 22
0
No subject
This is off-topic (apologies), but I thought I might get a lead or two here. I'm interested in generating random deviates from a multivariate distribution which is a generalization of the beta distribution -- the Bayesian canonical distribution for the parameter estimates of a multinomial distribution. Given a vector (length n-1) of probabilities p and a vector (length n) of shape
2003 Jan 27
1
rmultinom() -- how \\ via own C code?
I've had a need for multinomial "random number generation" occasionally. And other people too. The following code is currently in the (very small ``not very high importance'') CRAN package normix --- which I will rename to "nor1mix" very seen because of a ``name registration'' problem I want to add "this" (well the functionality) to a
2004 Mar 03
1
generating normal numbers: GetRNGstate, PutRNGstate
Hi I'd like to generate thousands of normal numbers from my C function using the C API functions provided R. I have two options: 1. double norm_rand(); (page 61 of R extension 1.8.1) 2. double rnorm(double mu, double sigma); (page 58 of R extension 1.8.1) If my understanding of R-exts is correct, then I only need to call GetRNGstate once, and then call 1000 norm_rand, and then call
2005 Nov 30
1
RNG stuck via Fortran call
Having not much success with my previous question I try to reformulate it: I'm simulating a Markow chain in Fortran interfaced with R. Each loop of my Fortran calls various functions of the R RNG through the wrapper given below. In a run of 100 iterations of the Markov kernel, after 20 iterations, the RNG seems like frozen. For example, the first call to the RNG in my loop is:
2002 Jan 14
1
trouble using R Mathlib as standalone
Dear People, I am trying to use R's Math library as standalone, as documented in /src/nmath/standalone. I am using C++ in Debian testing, and the versions are as follows: ii g++-3.0 3.0.3-1 The GNU C++ compiler. ii r-mathlib 1.4.0-1 `GNU S' - Standalone R math library I have a file (rand.cc) as follows. I don't think that lattice.hh or mh.hh are very
2005 Jun 28
1
GetRNGstate() crashes in Windows
Hi, Has anyone managed to successfully call GetRNGstate() / PutRNGstate() without crashing in a Windows environment (spec. XP)? I've compiled successfully using both the latest Cygwin, latest Mingw, and the version of Mingw suggested in "Building R for Windows" website, but when the executable runs, it crashes; the functions themselves can run when I omit
2008 Jul 03
1
GetRNGstate and PutRNGstate
Hi, I've got a simulation function, written in C and called from R, that uses the R random number functions. It's not a very complicated simulation - 280 lines total, with the main function (the one called with .C) repeatedly calling another function, with multiple calls to unif_rand() in both functions. At the beginning of the main function I call GetRNGstate(), and the last thing I do
2002 Oct 17
1
underflow handling in besselK (PR#2179)
The besselK() function knows about overflows/underflows internally; there is a constant xmax_BESS_K in src/nmath/bessel.h (and referred to only in bessel_k.c), equal to 705.342, which is checked if expon.scaled is FALSE. (The equivalent number for bessel_i.c is 709, defined as exparg_BESS in bessel.h.) However, besselK(x) silently returns +Inf if x>705.342. This behavior is reasonable for
2001 Oct 15
0
possible bugs: boundary conditions and random distribution parameters
There are a few inconsistencies, at least, in some of the functions that generate random deviates from particular distributions (I think they're bugs because they're inconvenient, but maybe someone can make an argument for the current behavior). If people think these are really bugs I can submit them, together or separately. 1. rlnorm(n,mean,sd) gives NaN for sd=0, rather than always
2006 Aug 03
1
question about dll crashing R
I have ported some R code to C to make it faster. I can perform .Call("foobar",....) once and it works fine. Absolutely correct answer. If I put a loop inside foobar and run the main code routine more than 100 times, it crashes R. Or if I call .Call("foobar"....) seperately more than two tims it crashes R. For the most part I am doing matirx multiplies using EXP
2002 Feb 06
1
1.3.1/1.4.1 Windows binary incompatibilities?
I should probably have been able to figure this out, but ... I have a package with some C code in it that I've been cross-building on my Linux machine to run under Windows. I had it working under 1.3.1, but it seems to have stopped with 1.4.1. Building with a version of i386-mingw32msv-gcc recently downloaded from Brian Ripley's Rtools page (--version 2.95.2), under 1.4.1 on Linux, it
2001 Oct 15
1
creating packages for Mac
OK, a boneheaded question ... I've made a set of packages for my students. I'm serving these packages from my web site in the form of a set of tar.gz source packages (constructed with R CMD build) and a set of .zip Windows binary packages, constructed by cross-compiling according to Brian Ripley's instructions (make pkg-foo in the src/gnuwin32 directory) and then zipping up the
2000 May 31
1
legend with multiple columns
I have made a minor hack to "legend" (in R 1.0.0, but I didn't notice any changes to legend in the 1.0.1 NEWS) to allow the legend to be formatted in multiple columns, or horizontally (number of columns <- number of legend items). (I find this helpful when I have lots of legend items and not a lot of vertical space to squeeze the legend into.) (Another hack I've considered
2004 May 07
1
mle
I'm very excited by the new mle package now incorporated in stats4. If possible, I'd like to help develop it. In the past I wrote a similar package (mleprof, available from http://www.zoo.ufl.edu/bolker/R/src), and would like to see if there's anything that my package does that I could contribute (in particular, I'd like to make sure that the code is as robust as possible in
2005 Apr 11
0
correlation range estimates with nlme::gls
I'm trying to do a simple (?) analysis of a 1D spatial data set, allowing for spatial autocorrelation. (Actually, I'm comparing expected vs. observed for a spatial model of a 1D spatial data set.) I'm using models like gls(obs~exp,correlation=corExp(form=~pos),data=data) or gls(obs~exp,correlation=corLin(form=~pos),data=data) This form is supposed to fit a linear model of
2003 Oct 20
0
Re: [R] R - S compatibility table (fwd)
I appreciate Brian and Martin's answers -- and I certainly don't spend as much time & energy maintaining and answering questions about R as they do -- *but* it does seem to me that it would make a number of new (switching) user's lives easier if there were a succinct list of these differences, with a disclaimer ... I would be willing to maintain such a list, but since I
2001 Sep 20
0
3d java etc.
There was some interest in the commands for creating an HTML file of 3D graphics that can be shown with a Java applet. Looking at things I discovered (of course) that I should really clean up quite a few things before releasing it for real. I hope to do some of that this weekend. In the meanwhile, here are a couple of pointers to the Java applet & documentation (apparently free for
2002 Feb 13
0
glmms with negative binomial responses
I am trying to find a way to analyze a "simple" mixed model with two levels of a treatment, a random blocking factor, and (wait for it) negative binomial count distributions as the response variable. As far as I can tell, the currently available R offerings (glmmGibbs, glmmPQL in MASS, and Jim Lindsey's glmm code) aren't quite up to this. From what I have read (e.g.
1999 Oct 18
1
memory efficiency in R
I'm trying to answer a question from a student about memory use in R (I won't go into the details right here). I have a really vague memory of having read a document, possibly by Venables or Ripley, discussing the awfulness of memory allocation in S-PLUS, and giving (in the context of a bootstrapping analysis of shoe size data??) some general strategies for conserving memory in S-PLUS.
2002 Nov 08
2
behavior of =
I probably didn't follow the discussion of allowing "=" as an assignment operator closely enough, but I was a little bit horrified to discover today (using 1.6.0; I haven't upgraded to 1.6.1 yet) that x <- runif(20) y <- 1:20 y[x=min(x)] gives numeric(0) (because min(x) is non-integer). x <- sample(1:20,20,TRUE) y[x=min(x)] is even worse -- it gives the