similar to: Interfacing R and C++

Displaying 20 results from an estimated 10000 matches similar to: "Interfacing R and C++"

2006 Jan 10
3
Issue with c++ .C call
I am still having some difficulties with connecting R to a C++ function. I am able to call the function as expected after compiling the shared library and such. However, the call to the function is via .C; parameters from the .C call are not being passed correctly to the function. As an example, I have attached a GDB run of the code. I set a breakpoint on entry to the function I am calling
2007 Feb 04
2
Problem using ofstream in C++ class in package for MacOS X
Dear all, I am currently learning how to create R packages using C++ classes. For this purpose I have written a small package MyClass (which I try to attach since I do not have access to a website). MyClass has methods WriteFileC() and WriteFileCpp() which implement C-style and C++-style writing of a table to a file using FILE or ofstream respectively, and the corresponding R-functions
2010 Apr 23
3
substract start from the end of the vector
Dear group, Here is my df : df <- structure(list(DESCRIPTION = c("PRM HGH GD ALUMINIUM USD 09/07/10 ", "PRM HGH GD ALUMINIUM USD 09/07/10 ", "PRIMARY NICKEL USD 04/06/10 " ), CREATED.DATE = structure(c(18361, 18361, 18325), class = "Date"), QUANITY = c(-1L, 1L, 1L), CLOSING.PRICE = c("2,415.90", "2,415.90",
2005 Aug 15
2
R CMD check failure on minimal code
I have a peculiar problem that I'm sure is a simple one, but I can't figure out what my mistake is. Can someone enlighten me? I have a simple file, class.R: ## setClass("abc",representation(a = "character", b = "ANY")) I have a package directory ExpressCGH1 made with package.skeleton. The package happily builds and installs, but R CMD check fails with
2005 Oct 18
1
RMySQL problems
I get the following error trying to connect to a MySQL database: > library(RMySQL) Loading required package: DBI > drv<-dbDriver("MySQL") > con<-dbConnect(drv, user="hothand", password=xxx, host="localhost", dbname="hh03"); Error in mysqlNewConnection(drv, ...) : RS-DBI driver: (could not connect hothand at localhost on dbname
2013 Feb 19
2
Cramer von Mises test for a discrete distribution
Hi, ? I'm trying to carry out Cramer von Mises tests between pairs of vectors belonging to a discrete distribution (concretely frequencies from 0 to 200). However, the program crashes in the attempt. The problem seems to be that these vectors only have positive integer numbers (+ zero). When I add a random very small positive decimal to the non-decimal part everything works fine (files prm1
2006 Apr 19
2
par(tmag) question
Dear list, I'm trying to understand the graphical parameters by a systematic exploration of the par() function (if you are interested by the result it's here http://pbil.univ-lyon1.fr/R/fichestd/tdr75.pdf, the comments are all in french but it's pure R code under Sweave). I have a problem with par(tmag) illustrated by the following code:
2010 Apr 16
1
data frame manipulation
Dear group, Here is my data.frame : df <- structure(list(DESCRIPTION = c("PRM HGH GD ALU", "PRM HGH GD ALU", "PRIMARY NICKEL", "PRIMARY NICKEL", "PRIMARY NICKEL", "PRIMARY NICKEL", "STANDARD LEAD ", "STANDARD LEAD ", "STANDARD LEAD ", "STANDARD LEAD ", "STANDARD LEAD ",
2006 Mar 09
1
lsa and Rstem?
Dear r-helpers, I can't get lsa to run because: > library(lsa) Loading required package: Rstem Error in library(pkg, character.only = TRUE, logical = TRUE, lib.loc = lib.loc) : 'Rstem' is not a valid package -- installed < 2.0.0? In addition: Warning message: cannot create HTML package index in: make.packages.html() > install.packages('Rstem') Warning in
2005 Jul 19
1
S4 Dispatching
Is it possible for S4 to (continue) dispatch to a class created during dispatching? The code below doesn't work; is this not possible or have I ommitted something? Concept was to create a SEXP with R_AllocatePtr, give it a class attribute, and continue dispatch. Example code below omits multiple parameters that can be different types. Essentially, any parameter would be converted to an
2006 Mar 16
3
sub returns garbage (PR#8687)
Full_Name: Todd Bailey Version: 2.1 OS: Mac OS-X 10.4.3 Submission from: (NULL) (87.112.79.124) sub returns garbage in some strings when replacing something with nothing and fixed=TRUE. For example: > a=c('hello','hello'); sub('lo','',a,fixed=TRUE) [1] "hel" "hel\0\0" > a=c('hello','hello');
2005 Oct 26
1
Pb encountered with demos
Hi all, I've just installed R on my Mac & PC. The base demo run fine.. But I'm encountering several pb with some packages (installed using CRAN binaries using the menu) - Lattice: > demo(lattice,package='lattice') demo(lattice) ---- ~~~~~~~ Type <Return> to start : > require(grid) [1] TRUE > old.prompt <- grid.prompt(TRUE) > old.settings
2005 Oct 29
1
dyn.load() error: bad external relocation length
R-helpers, Is there an easy way to call an external (C) program using .C or .Call without including the code in a package. I know how to do it using system(), but that doesn't seem to be a permanent or portable solution. Initially I tried: .Call('filepath.to.c.function', arg1) and got this error: Error in .Call("filepath.to.c.function", "arg1", :
2005 Dec 07
1
Dots argument in apply method
Hello everyone, I'm working on a package using S4 classes and methods and I ran into the following "problem" when I tried to create an "apply" method for objects of one of my new classes. I've found a way around the problem but I wonder if I did not paint myself into the corner. I'd like your opinion about that. So I have an object "myObj" of class
2006 Feb 08
1
invalid graphics state using dev.print (fwd)
On Mon, 6 Feb 2006 18:12, Simon Urbanek wrote: > On Feb 6, 2006, at 5:24 PM, Paul Roebuck wrote: > >> Tried on R-Sig-Mac with no responses, but I need some kind >> of answer. >> [...] >> Does the following work on your system? > > Interesting, no, it doesn't either. For png and pdf I use > Quartz + quartz.save (it produces much nicer results) so > I
2007 Mar 30
2
Replacing slot of S4 class in method of S4 class?
Dear all, Assume that I have an S4 class "MyClass" with a slot "myname", which is initialized to: myname="" in method("initialize"): myclass <- new("MyClass", myname="") Assume that class "MyClass" has a method "mymethod": "mymethod.MyClass" <- function(object, myname=character(0), ...) {
2011 Oct 31
1
Question about copying reference objects using the initialize method
Dears, I have a question about copying reference objects using the initialize method. 1) If the latter has no arguments, there is no problem to copy an object. myClass = setRefClass("myClass", fields = list(value = "numeric") ) myClass$methods(initialize = function(...){ ? value <<- 1 ? callSuper(...) }) newObject = myClass$new() newObject$value = 2 copyObject =
2005 Jul 13
1
unexpected par('pin') behaviour
hi everybody, I noticed the following: in one of my scripts 'layout' is used to generate a (approx. square) grid of variable dimensions (depending on no. of input files). if the no. of subplots (grid cells) becomes moderately large (say > 9) I use a construct like ###layout grid computation and set up occurs here### ... opar <- par(no.readonly = T);
2010 Apr 15
1
sum rows in a data.frame...solution
Found this solution. It is maybe not the most elegant way, but it does the job. > a=as.data.frame(substr(lme$DESCRIPTION,1,14)) > colnames(a)=c("DESCRIPTION") > lme=as.data.frame(c(a,lme[,2:3])) > lme DESCRIPTION CLOSING.PRICE POSITION 1 PRIMARY NICKEL 25,755.7100 0 2 PRIMARY NICKEL 25,760.8600 0 3 PRM HGH GD ALU 2,415.9000 0
2008 Dec 22
1
How to add a slot to S4 class of an existing package?
Dear all, Since my package is based on S4 classes, I would like to know how to add a slot to an existing S4 class without breaking the code of users of my package. Assume the following S4 class: setClass("MyClass", representation(name = "character", type = "character", data = "data.frame" ), prototype(name =