[Rd] OpenMP and random number generation

2012-02-22 Thread Mathieu Ribatet
Dear all, Now that R has OpenMP facilities, I'm trying to use it for my own package but I'm still wondering if it is safe to use random number generation within a OpenMP block. I looked at the R writing extension document both on the OpenMP and Random number generation but didn't find any info

[Rd] Changing graphic titles when using bquote and resizing the graphic window

2011-11-24 Thread Mathieu Ribatet
Dear list, I found a strange behavior of the graphic display when using bquote to set a title to a plot. The problem arise when you manually resize the graphic window using the mouse. It happens on both quartz and x11 devices. Here's a reproducible example: par(mfrow = c(1,3)) for (i in 1:3){

[Rd] Small inconsistency with boxplot

2011-11-17 Thread Mathieu Ribatet
Dear R-core team, I think I found a small inconsistency in the boxplot function. I don't want to post it as a bug since I'm not sure this might be considered as one according to the FAQ --- and this is not a major problem. Don't hesitate to tell me if I'm wrong. If you try to do a boxplot on a

Re: [Rd] R CMD check: Error in .C

2009-10-26 Thread Mathieu Ribatet
Dear Etienne, You probably want to create a zzz.R file in the /mypkg/R/ folder which is just .First.lib <- function(lib, pkg){ library.dynam("MyPkgName", package = pkg, lib.loc = lib) return(invisible(0)) } This would ensure that your shared library will be lo

Re: [Rd] Possible bug in the Rd parser?

2009-10-11 Thread Mathieu Ribatet
rdoch wrote: > > On 10/10/2009 8:07 AM, Mathieu Ribatet wrote: > >> Dear list, > >> > >> I got an automatic email complaining than some of my packages didn't > >> pass 'R CMD check' for R-2.10.0 alpha anymore. Both of them make use of > >> t

[Rd] Possible bug in the Rd parser?

2009-10-10 Thread Mathieu Ribatet
Dear list, I got an automatic email complaining than some of my packages didn't pass 'R CMD check' for R-2.10.0 alpha anymore. Both of them make use of the "cases" LaTeX environment. Inspecting the log outputs I got: LaTeX errors when creating PDF version. This typically indicate

Re: [Rd] Problem in matrix definition?

2009-08-31 Thread Mathieu Ribatet
Dear Fabio, The problem is that L[k,1:(r-1)] is not anymore a matrix but a vector. Hence when you do t(L[k,1:(r-1)]) you get a matrix with only one row while I think you expected one column instead. You can see this feature with a simpler example like the following one: x <- runif(10)

Re: [Rd] Checking package on Windows (and seemingly irreproducible errors in CRAN checks)

2009-07-28 Thread Mathieu Ribatet
Dear Carlos, >From your check results: cbc.data <- cbc.read.table( system.file("data", "cbc.test.data.txt", package = "colbycol"), sep = "\t" ) Warning in file(file, "r") : cannot open file '0001': No such file or directory I think you're t

Re: [Rd] beginner's guide to C++ programming with R packages?

2009-06-29 Thread Mathieu Ribatet
An other possibility is to insert new features in your package once you feel pretty confident with your new code. "R CMD SHLIB myfile.c" will build the SHared LIBrary and then load it in R by invoking "dyn.load("myfile.so")" in an R console. Once you're satisfied with your code, just do as you did

Re: [Rd] Show location of workspace image on quit?

2009-06-05 Thread Mathieu Ribatet
I guess that having something like this > q() > Save workspace image (/home/me/workspace/.RData)? [y/n/c/e]: where "e" means Editing the path should be clear enought, isn't it? Best, Mathieu Le vendredi 05 juin 2009 à 14:36 +0200, Wacek Kusnierczyk a écrit : > Duncan Murdoch wrote: > > On 05/06/

Re: [Rd] How to generate R objects in C?

2009-06-03 Thread Mathieu Ribatet
This is indeed details in Writing R Extensions. You should have a closer look at sections 5.9.3 and 5.9.4. Look at the pieces of C code, they will help you a lot. cheers, Mathieu Le mercredi 03 juin 2009 à 00:44 +0200, Kynn Jones a écrit : > I'm in the process of coding a parser (in C) to genera

Re: [Rd] 'is.integer' (PR#13671)

2009-04-22 Thread Mathieu Ribatet
To the best of my knowledge this is not a bug. According to FAQ 3.3.3 "Numeric constants with no fractional and exponent (i.e., only integer) part are taken as integer in S-Plus 6.x or later, but as double in R." You can see it by invoking >storage.mode(1) [1] "double" Hence, if you really want t

Re: [Rd] Hello! I got error in C - R

2009-04-02 Thread Mathieu Ribatet
Dear Ick Hoon Jin, Your problem is probably due to a misspecification in memory allocation within your C code. To solve this you can: * check by yourself whenever there is C memory allocation - by the way I think it's best to use R memory allocation i.e. R_alloc * use valgrind

Re: [Rd] R does not start on my MacBook Pro3,1 (PR#13565)

2009-03-02 Thread Mathieu Ribatet
I'm not sure this will work under MacOS but you should try to run R from a shell and see any informative message displayed in it. Cheers, Mathieu * it might be useful to give us some details about the code you ran and caused the issue. Le lundi 02 mars 2009 à 17:15 +0100, marycme...@mac.com a éc

Re: [Rd] Strange behavior of C compiled program

2009-02-09 Thread Mathieu Ribatet
You might have a look at the "Writing R Extensions" manual - especially valgrind and/or gdb. By the way, your error is probably due to array size problem - i.e. tmp is of size n and you call tmp[n+1] for example. Valgrind will detect in automagically for you. Best, Mathieu Le lundi 09 février 20

Re: [Rd] Strange behavior of C compiled program

2009-02-08 Thread Mathieu Ribatet
Hi Christophe, The problem might be that you used %d when printing. I guess that your variables dist and tmp are double so you have to use %f instead. Best, Mathieu Le dimanche 08 février 2009 à 23:37 +0100, Christophe Genolini a écrit : > Hi the list, > > I need to include some C code in R, bu

Re: [Rd] uninitialised value in R (PR#13476)

2009-01-28 Thread Mathieu Ribatet
0x805B3E7: R_ReplConsole (main.c:306) ==18032==by 0x805B6D7: run_Rmainloop (main.c:966) ==18032==by 0x8058F80: main (Rmain.c:33) Error in .Call("XXX") : C symbol name "XXX" not in load table Have you named the file u.c or u.cc? Cheers, Martin Mathieu Ribatet wrot

Re: [Rd] uninitialised value in R (PR#13476)

2009-01-27 Thread Mathieu Ribatet
Hi Martin, I wasn't able to compile your files. Replacing "extern "C" SEXP XXX();" by "SEXP XXX();" solve the issue and I got no message from valgrind - I'm not sure this is what you really want to do though. I hope this might help. Cheers, Mathieu schlat...@math.uni-goettingen.de a écrit :

Re: [Rd] legend() in a multiple figure environment

2009-01-08 Thread Mathieu Ribatet
Dear Simone, Did mean that the legend (text and/or box) overlap with the Normal density? If so then I think there's no problem as the legend is placed where you told R to do. And R won't check (for you) if it will overlap or not with pre-existing graphical elements. On my computer, I got the

Re: [Rd] package development

2008-12-11 Thread Mathieu Ribatet
Dear Terry, One way to locate which file is wrong - surely not the most brillant way! You could do an R script that sources each of your .R files within a "for (file in file.names)" loop. When R will stop, it will indicate which file has a wrong syntax and more info. Cheers, Mathieu Terry T

Re: [Rd] any suggestions to deal with 'Argument list too long' for a R CMD check?

2008-12-09 Thread Mathieu Ribatet
Just a suggestion. I googled for your error message you got e.g. "make ... error 127" and I got Yeah, error 127 indicates that make can't find a program that it needs to run a command. My guess would be that she doesn't have g++ installed (some distributions package it separately from gcc so it

Re: [Rd] Suggestion for the optimization code

2008-08-08 Thread Mathieu Ribatet
Ok, please consider it as a bad call. Thanks for your answers. Best, Mathieu Prof Brian Ripley a écrit : On Fri, 8 Aug 2008, Mathieu Ribatet wrote: Dear list, Here's a suggestion about the different optimization code. There are several optimization procedures in the base package (

[Rd] Suggestion for the optimization code

2008-08-08 Thread Mathieu Ribatet
Dear list, Here's a suggestion about the different optimization code. There are several optimization procedures in the base package (optim, optimize, nlm, nlminb, ..). However, the output of these functions are slightly different. For instance, 1. optim returns a list with arguments par

Re: [Rd] Numerical optimisation and "non-feasible" regions

2008-08-07 Thread Mathieu Ribatet
est.eigen.value if the smallest eigen value is smaller than eps. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User") Mathieu Ribatet wrote: Thanks Ben for your tips. I'm not sure it'll be so eas

Re: [Rd] Numerical optimisation and "non-feasible" regions

2008-08-07 Thread Mathieu Ribatet
Thanks Ben for your tips. I'm not sure it'll be so easy to do (as the non-feasible regions depend on the model parameters), but I'm sure it's worth giving a try. Thanks !!! Best, Mathieu Ben Bolker a écrit : Mathieu Ribatet epfl.ch> writes: Dear list, I'm c

[Rd] Numerical optimisation and "non-feasible" regions

2008-08-06 Thread Mathieu Ribatet
Dear list, I'm currently writing a C code to compute the (composite) likelihood - well this is done but not really robust. The C code is wrapped in an R one which call the optimizer routine - optim or nlm. However, the fitting procedure is far from being robust as the parameter space depends

Re: [Rd] Adding .PDF files to a package

2008-08-06 Thread Mathieu Ribatet
Dear Rense, The way you included your pdf file in your package is appropriate. Normally, when invocking "help.start()" and going to your package link, you should have two links overview and directory where your pdf file should be located. Best, Mathieu Rense Nieuwenhuis a écrit : Deal all,

Re: [Rd] package has a loading problem

2008-07-10 Thread Mathieu Ribatet
Have you create a zzz.R file in the R folder? I think your issue is related to this... Example of the zzz.R file: ".First.lib" <- function(lib, pkg) { library.dynam("your_pkd_name", package = pkg, lib.loc = lib) return(invisible(0)) } This is required when you have C/Fortran code. See the wr

[Rd] Editing the "..." argument

2008-07-05 Thread Mathieu Ribatet
Dear all, I'd like tweaking the ... arguments that one user can pass in my function for fitting a model. More precisely, my objective function is (really) problematic to optimize using the "optim" function. Consequently, I'd like to add in the "control" argument of the latter function a "n

Re: [Rd] Problem in conditional looping

2008-06-27 Thread Mathieu Ribatet
Why don't you consider a "while" loop e.g. while (Pij < 0) ##Then you resample according to your code Nadeem Shafique a écrit : Respected All, I am writing a program in R and facing some problem with applying "if statment". Program first draw random numbers from bivariate normal distribution

Re: [Rd] Have you ever experienced this problem with REAL in a C code

2008-05-09 Thread Mathieu Ribatet
en garbage-collected before use. - memory corruption, most often by writing outside array bounds. See the chapter in 'Writing R Extensions' about this, and if possible make use of valgrind. On Fri, 9 May 2008, Mathieu Ribatet wrote: Dear all, I'm currently experiencing big troub

[Rd] Have you ever experienced this problem with REAL in a C code

2008-05-09 Thread Mathieu Ribatet
Dear all, I'm currently experiencing big troubles with my C code called by .Call in a R function. I know this may not be the right place for such things but these errors are driving me crazy. And I hope other people may have already experienced these problems so that they could give me go

Re: [Rd] r won't start: "r: symbol lookup error: r: undefined symbol: (PR#11273)

2008-04-25 Thread mathieu . ribatet
> I tried installing r on my computer, and didn't manage to get the program > running. > After having installed littler, typing r into the bash results in following > message: > > r: symbol lookup error: r: undefined symbol: R_Visible > Did you invoke "r" or "R" because it is totally different

Re: [Rd] r won't start: "r: symbol lookup error: r: undefined symbol: R_Visible" (PR#11265)

2008-04-25 Thread Mathieu Ribatet
> I tried installing r on my computer, and didn't manage to get the program > running. > After having installed littler, typing r into the bash results in following > message: > > r: symbol lookup error: r: undefined symbol: R_Visible > Did you invoke "r" or "R" because it is totally different

Re: [Rd] prod(0, 1:1000) ; 0 * Inf etc

2008-04-22 Thread Mathieu Ribatet
>> I definitely do agree with you. >> Basically, I see two different ways to proceed: >> >>1. one could first check if there are any 0 in the vector and then >> return 0 without computing the product >> > > That would fail for prod(0,Inf), which should return the same > thing as 0*I

Re: [Rd] prod(0, 1:1000) ; 0 * Inf etc

2008-04-21 Thread Mathieu Ribatet
I definitely do agree with you. Basically, I see two different ways to proceed: 1. one could first check if there are any 0 in the vector and then return 0 without computing the product 2. or convert prod(x1, x2, x3) in prod(c(x1, x2, x3)) Both approaches are similar except for the pa

[Rd] Extending R formulas

2008-04-20 Thread Mathieu Ribatet
Dear list, I'm currently trying to write a new R package to model spatial extremes. In particular, for a model fitting procedure, I'd like to use flexible response surfaces (like linear models, splines, ...) for the parameters of my model. Following this idea, I'd like to allow "a new inte

Re: [Rd] Incorrect @INC: Rcmd SHLIB error under Windows (2.6.2, 44383) (PR#11161)

2008-04-14 Thread Mathieu Ribatet
Has your environment variable path been set correctly? It's been a while that I'm not using R under windows but remember had experienced the same error. I remember that I had to put many paths as environment variable to build R packages properly. Best, Mathieu [EMAIL PROTECTED] a écrit : > Hi

Re: [Rd] Incorrect @INC: Rcmd SHLIB error under Windows (2.6.2, 44383) (PR#11165)

2008-04-14 Thread mathieu . ribatet
Has your environment variable path been set correctly? It's been a while that I'm not using R under windows but remember had experienced the same error. I remember that I had to put many paths as environment variable to build R packages properly. Best, Mathieu [EMAIL PROTECTED] a écrit : > Hi

Re: [Rd] && and ||

2008-04-14 Thread Mathieu Ribatet
Well, you just have to use "&", "|" instead of "&&", "||". Best, Mathieu Yuan Jian a écrit : > Hello there, > > I got a small problem about logical calculation: > we can get a sequene from a+b as below: > > > a<-c(1,2) > >> b<-c(3,4) >> a+b >> > [1] 4 6 > > but when th

Re: [Rd] Matrix multiplication in a C code

2008-04-13 Thread Mathieu Ribatet
Brian Ripley a écrit : > On Sun, 6 Apr 2008, Mathieu Ribatet wrote: > >>Dear list members, >> >> I've got a small question on matrix multiplications in a C code. Because >> of a really cpu demanding likelihood, I had to use a C code within an R >> functi

[Rd] Matrix multiplication in a C code

2008-04-06 Thread Mathieu Ribatet
Dear list members, I've got a small question on matrix multiplications in a C code. Because of a really cpu demanding likelihood, I had to use a C code within an R function wrapper. I'm pretty sure that there is already one good code for matrix multiplication in C - maybe in the R source co