similar to: Dealing with R list objects in C/C++

Displaying 20 results from an estimated 3000 matches similar to: "Dealing with R list objects in C/C++"

2009 Sep 29
3
How do I access class slots from C?
Hi I'm trying to implement something similar to the following R snippet using C. I seem to have hit the wall on accessing class slots using C. library(fPortfolio) lppData <- 100 * LPP2005.RET[, 1:6] ewSpec <- portfolioSpec() nAssets <- ncol(lppData) setWeights(ewSpec) <- rep(1/nAssets, times = nAssets) ewPortfolio <- feasiblePortfolio( data = lppData, spec = ewSpec,
2012 Apr 18
1
C - R integration: Memory Issues
Hi all, I am a PhD student and I am working on a C project that involves some statistical calculations. So, I tried to embed R into C, in order to call R functions from a C program. My program seems to get the correct results from R. However, it appears to have a lot of memory allocation issues, in contrast to the small amounts of memory that my code allocates. Some additional info
2009 Aug 25
2
Clarifications please.
Hi I think I have asked these questions earlier, but I been able to find answers from the documentation (which I found poorly written in several places). Will someone be kind enough to give me answers and enlighten me? (as in explain with CODE?) I want to embed R in my application and use the fPortfolio package for carrying out risk management computations. Right now I'm reading the Rmetrics
2010 Oct 27
2
must .Call C functions return SEXP?
For using R's .Call interface to C functions, all the examples I've seen have the C function return type SEXP. Why? What does R actually do with this return type? What happens if I *don't* return a SEXP? Reason I ask, is I've written some R code which allocates two long lists, and then calls a C function with .Call. My C code writes to those two pre-allocated lists, thus, I
2011 Mar 08
3
How to disable R's crash prompt
Dear R devel, I have a C++ app that calls into embedded R to perform some analytic calculations. When my app encounters a segmentation fault, R always prints the following crash prompt and asks me to enter an action: *** caught segfault *** address 0x8, cause 'memory not mapped' Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace
2009 Sep 16
2
I want to get a reference to this time series object
I'm trying to get a reference to this object in C SWX.RET[1:6,c("SBI,"SPI","SII")] While i am able to access and use a plain SWX.RET object, I'm getting confused on how to create an object with the array subscripts like above. Here is what I tried to do. It doesn't work because "[" is obviously not an operation or function on SWX.RET. So how do I
2001 Sep 10
1
not safe to return vector pointer
Hello All, I recently upgraded from R-1.1.1 to R-1.2.2. I have an R function that uses .Call() to return a list from C code. The C code has the form: SEXP function(SEXP var) { SEXP rlist ; PROTECT(rlist = NEW_LIST(3)) ; VECTOR_PTR(rlist)[0] = NEW_INTEGER(1) ; VECTOR_PTR(rlist)[1] = NEW_STRING(1) ; ... UNPROTECT(1) ; return(rlist) ; } When I try to
2015 Mar 02
1
R-devel does not update the C++ returned variables
On 2 March 2015 at 16:37, Martin Maechler wrote: | | > On 2 March 2015 at 09:09, Duncan Murdoch wrote: | > | I generally recommend that people use Rcpp, which hides a lot of the | > | details. It will generate your .Call calls for you, and generate the | > | C++ code that receives them; you just need to think about the real | > | problem, not the interface. It has its own
2014 Oct 22
1
Problems to compile examples of RInside
Hello, I have some problems to migrate to R >3.0 my devel machine (R.2.15.2). So I decided to start from scratch with a brand new virtual machine. Downloaded latest network install of debian testing, not stable (jessie/sid, SMP Debian 3.16.3-2 (2014-09-20) x86_64 GNU/Linux) installed only with ssh-server and basic utilities (no X). Then I installed R by: apt-get install
2015 Mar 02
3
R-devel does not update the C++ returned variables
On 03/02/2015 04:37 PM, Martin Maechler wrote: > >> On 2 March 2015 at 09:09, Duncan Murdoch wrote: >> | I generally recommend that people use Rcpp, which hides a lot of the >> | details. It will generate your .Call calls for you, and generate the >> | C++ code that receives them; you just need to think about the real >> | problem, not the interface. It has its
2010 Nov 22
1
Using RInside in Visual Studio 8.0 VC++.NET Program
Hello, I am trying to use Rinside package in my VC++.Net program ( using Visual Studio 8.0 environment). I have downloaded Windows binary of RInside from the following link http://cran.r-project.org/web/packages/RInside/index.htm Version of RInside - 0.2.3 While compiling the program , i am getting about 69 error. Some of them are the folllowing ones. Please me in solving the following issue
2012 Dec 05
1
RInside, rcpp compilation problem
I have spent some hours browsing the RInside and rcpp documentation, lots of it; but ... as a programmer of C++ since 1990, on both Windows and Unix ... ( Solaris and Ubuntu, and Mandrake/Mandrivo Linux); I see a minor problem ...... Where is the rcpp.h header file?? The below code fails to compile as the RInside.h header file references the rcpp.h header file, which is not included with
2010 Apr 30
2
RInside & child threads
Hi Folks, I am creating a multi-threaded C++ application that initializes RInside in one of the child thread. I would also like to access support interfaces like Rcpp::Environment in the remaining child threads, so that I could access any "R" function associated with the environment initialized. When I run my program, I always get "C Stack limit too huge" errors. I looked
2015 Dec 11
1
Runtime error when run a RInside program compiled by intel c++ on windows
I have intstalled R-3.2.2,Rcpp-0.12.2,RInside-0.2.13 on windows. I compiled the example1 of RInside in the example directory which create a RInside instance and prints "hello world". The compiler is intel c++. I included the RInside source files in the project and fixed the compile and link errors. But when run the executable file it prints some error message and quites. I debug
2014 Apr 03
1
question regarding lang2 command in C
Hi , I am asking too many questions , sorry for that . I am creating a data frame in C itself , reading a table . The data frame calling code looks like this ====================================== *PROTECT(dfm=lang2(install("data.frame"),df));* *SEXP res = PROTECT(eval(dfm,R_GlobalEnv));* UNPROTECT(2); return res; ================================== It works fine , now the problem
2010 Mar 22
3
Embed R code in C++
Hi, Can anyone tell me how to embed R code in a C++ file. I am actually using a mac running on the OSX 10.6.2 and the IDE Xcode Version 3.2 and I would like to embed the basic function like geometric, binomial, normal and hyper geometric distributions in a sample cpp file. I heard about the library RInside and i have downloaded the source code for mac but i do not know how to build it in
2015 Jun 19
1
QT + RInside problem complement
The solution post is here: http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2012-November/004771.html In the paragraph: I did need however to install Rcpp and RInside from source, and with the same compiler used to compile qtdensity (otherwise I would get additional linker errors). As I had trouble getting the (Cygwin-based) g++ shipped with Rtools to work with Qt, I used instead the
2010 Jul 12
1
RInside
Hi, I am new to this list and apologize for my lack of experience in the subject. Does anyone here use RInside? I am trying to run the examples in /RInside/examples/standard such as rinside_sample_0, but I am getting the error: error while loading shared libraries: libR.so: cannot open shared object file: No such file or directory Does anyone know how to deal with this? I tried searching
2011 Sep 11
5
Link between Qt GUI and R
hi, i want to build a Qt front-end GUI which communicates with R, and i am not sure what i should use for the interface. There seems to be many ways: R.dll, Rinside, Rcpp, RQt, Rtools... . what is the best way? please advice. basically what i want to do is that, the Qt GUI will allow users to make selection and enter numbers, these inputs will be fed to R, already written .R files will perform
2018 Sep 21
1
Bias in R's random integers?
On 9/20/18 5:15 PM, Duncan Murdoch wrote: > On 20/09/2018 6:59 AM, Ralf Stubner wrote: >> It is difficult to do this in a package, since R does not provide access >> to the random bits generated by the RNG. Only a float in (0,1) is >> available via unif_rand(). > > I believe it is safe to multiply the unif_rand() value by 2^32, and take > the whole number part as an