Displaying 20 results from an estimated 100000 matches similar to: "Call user written R functions in C"
2007 Jul 04
1
Calling C Code from R
Hi R Users,
Thanks in advance.
I am using R-2.5.1 on Windows XP.
I am trying to call C code (testCX1.C) from R. testCX1.c calls another C code (funcC1.c) and returning a value to testCX1.c. I like to have this value in R.
My steps are below:
1. R CMD SHLIB testCX1.c funcC1.c (at command propmt)
2. It creates testCX1.dll with warning (but testCX1.dll works):
2023 Feb 16
0
User-defined RNG with the standalone Rmath library
I have two questions about using a user-defined random number generator (RNG) with the standalone Rmath library. The default RNG with the standalone Rmath library is the Marsaglia-multicarry generator, which has poor properties. The "R Installation and Administration" manual, in the section "The standalone Rmath library", states that:
```
A little care is needed to use the
2010 Jul 20
1
Call to rgamma using .C causes R to hang
Hi,
I've been trying to get this working for ages, but it causes R to hang.
Here is my C code saved as test1.c
# include <R.h>
# include <Rmath.h>
void test1 (double *x, double *result)
{
result[0] = rgamma(*x, 2.0);
}
This was compiled using R CMD SHLIB test1.c & loaded in R using:
dyn.load("test1.dll")
out <-
2010 Jun 10
1
Rmath.dll importing in VB6 problem
Hi,
I am facing a problem which i think i need to explain it to you with some
background.
I need to use the Project R pnorm function in Visual Basic 6.0.
I have already installed R and this is how i perform and get back the
result:
> pnorm(2, 15)
[1] 6.117164e-39
which is what i need.
I have already installed R, i generated the Rmath.DLL file out so i can
import it into my VB6 and use it.
2009 May 07
2
How to call time series functions from C ?
Hi everyone,
I meet the problem to call R from C.
Can someone tell me is it possible to call time series functions(such as ar and arima)from C program on linux platform, and then compile the C program to a standalone executable file?
I know we can call some function defined in Rmath.h , but I have not found the entry point for time series function.
I would very much appreciate
2011 Aug 08
1
Making rmath.dll (or equivalent)
I currently have R 2.12.1 installed, both 32 and 64 bit. I also have a file
that was passed to me named rmath.dll. I do not know what version of R it
was created from, but I do know it is 32-bit only. I am developing an
application in C# that uses this library as a reference but I have to
downgrade it to 32-bit in order to use the DLL file.
I wish to make a rmath.dll from the version of R I have
2005 Oct 28
1
Calling R functions from C
Dear R users,
I read on the "Introduction to the .C Interface to R" by Peng & Leeuw
(http://www.biostat.jhsph.edu/~rpeng/docs/interface.pdf) that it is
possible to use a few R functions (such as "dnorm") within C by
including the "Rmath.h" header file in your C code:
e.g.
#include <R.h>
#include <Rmath.h>
void kernel_smooth(double *x, int *n,
2006 Jun 29
1
using "rbinom" in C code gives me erroneous results... random variable is not random (always zero)...
Dear Listers,
I am trying to use "rbinom" in my C code, but i always get zeros as output no matter the probability. Am not sure what I am doing wrong because the function has worked before. Attached in an example. Noticed that "rbinom" expects 'n' to be REAL.
Regards, Vumani
R 2.3.1 (2006-06-01)
Windows XP
Gcc
/* Called this file binom.c and then ran rcmd shlib on it
2005 Oct 31
1
R-functions in C-Code
Dear R users,
I would like to use several R functions from a C-code and I have read the "Introduction to the .C Interface to R". Unfortunately, my shared library with the C-code works only in cases where I use R-routines that are defined Rmath.h, eg.
*************************************
less test.c:
#include <R.h>
#include <Rinternals.h>
#include <Rmath.h>
void
2016 Jul 01
0
Calling C implementations of rnorm and friends
On Fri, Jul 1, 2016 at 6:13 AM, Luis Usier
<luis.henrique.usier at gmail.com> wrote:
> Gabriel,
>
> Thanks for that! I guess I really should have figured that one out sooner,
> huh?
>
> I understand why that wouldn't be CRAN-compliant. But then, what *is* the
> proper way to do it? Is there any way I can call unexported functions from
> another package and have it
2005 Jul 25
1
Rmath library problems
Hello,
Has anybody successfully called the Rmath library from C using the MS
Visual Studio compiler (I am using Visual Studio 6.0)?
I have compiled the Rmath library using gcc, and the 'test.c' program
(which makes a call to qnorm) works fine when compiled with gcc. However,
I get a fatal memory error when I run it after compiling it with Visual C.
Would this memory problem be related
2010 Jun 18
4
C Interface
Greetings,
I am trying to call simple C-code from R.
I am on Windows XP with RTools installed.
The C-function is
#include <R.h>
#include <Rinternals.h>
#include <Rmath.h>
#include <Rdefines.h>
// prevent name mangling
extern "C" {
SEXP __cdecl test(SEXP s){
SEXP result;
PROTECT(result = NEW_NUMERIC(1));
double* ptr=NUMERIC_POINTER(result);
double t =
2003 May 13
0
call nlm from a dll?
Hello,
I would like to call nlm from my MS VC++ application via R.dll.
I see that Rmath.h provides interfaces to some functions, but not all. I
also see that I can build a "front-end" to R and then parse the results.
But I'm unable to find any simple way to just link in R.dll and call the
function directly from my application. Is this possible?
Thank you,
2009 Feb 20
1
C function calling in R
Dear all,
I have a problem in calling my C code from R. If I do not need to use
#include<R.h>, the codes work properly. But when I need to use it, my
codes produce an error as:
logpostCLM.cpp:7:15: error: R.h: No such file or directory
logpostCLM.cpp:8:24: error: Rinternals.h: No such file or directory
logpostCLM.cpp:9:19: error: Rmath.h: No such file or directory
logpostCLM.cpp:10:24:
2010 Jun 18
3
C interface
Greetings,
I am trying to call simple C-code from R.
I am on Windows XP with RTools installed.
The C-function is
#include <R.h>
#include <Rinternals.h>
#include <Rmath.h>
#include <Rdefines.h>
// prevent name mangling
extern "C" {
SEXP __cdecl test(SEXP s){
SEXP result;
PROTECT(result = NEW_NUMERIC(1));
double* ptr=NUMERIC_POINTER(result);
double t =
2011 Jan 20
1
Calling C++ from R
Hi All,
I am new to this area and use Rcpp to call C++ from R and try to build the
package under Windows 7. I use Rtools and R 2.10.1 32bit. Everything works
fine with me, except using R functions like "rnorm" or "runif" in the C++
code. When I use "R CMD check" the package, it always return error
** libs
making DLL ...
g++
2016 Jul 01
1
Calling C implementations of rnorm and friends
Well,
For this particular use case why not just transform the parameters at the R
level and then call the existing function? Is there not a closed form
mapping?
~G
On Jul 1, 2016 2:50 PM, "Joshua Ulrich" <josh.m.ulrich at gmail.com> wrote:
> On Fri, Jul 1, 2016 at 6:13 AM, Luis Usier
> <luis.henrique.usier at gmail.com> wrote:
> > Gabriel,
> >
> >
2005 Aug 11
1
include C functions from nmath in my own C functions
Hi:
I followed the README in src/nmath/standalone/
to make the use the command "make shared" to make the
libRmath.so file. I also add the directories containg
libRmath.so to LD_LIBRARY_PATH by using command
"export
D_LIBRARY_PATH=$LD_LIBRARY_PATH:$/home/zhliu/Backup/R-2.0.1/src/nmath/standalon
e
"
However, when I try to run the following codes by the
command
2007 Mar 08
1
Calling Optim() from C
Hello:
I am sure this question was dealt with several years ago. Is the function
vmmin() available from Rmath Standalone? If not is it possible to call
optim() or nlm() from Rmath in C. Thank you.
Mervyn
2005 Aug 11
1
include C functions from nmath in my own C functions
Hi:
I followed the README in src/nmath/standalone/
to make the use the command "make shared" to make the
libRmath.so file. I also add the directories containg
libRmath.so to LD_LIBRARY_PATH by using command
"export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$/home/zhliu/Backup/R-2.0.1/src/nmath/standalon
e
"
However, when I try to run the following codes.