[Rd] using C code to create data frame but always return as list

2014-06-23 Thread Yu Gong
there is my code,  expect return value  is a data frame but R say it is list: SEXP Julia_R_MD_NA_DataFrame(jl_value_t* Var) {  SEXP ans,names,rownames;  char evalcmd[4096];  int i;  const char* dfname="DataFrameName0tmp";  jl_set_global(jl_main_module, jl_symbol(dfname), (jl_value_t*)Var);  //Get

Re: [Rd] Curious behavior of $ and lapply

2014-06-23 Thread Kevin Ushey
`lapply` basically takes its call and massages into calls of the following form: FUN(X[[1L]], ...) FUN(X[[2L]], ...) ... that get evaluated in the appropriate environment. For `lapply(list(list(a=3,b=4)),"$","b")`, you can imagine that a function `FUN` of the form: FUN <- funct

Re: [Rd] operation on ‘numsels’ may be undefined

2014-06-23 Thread Kevin Ushey
I don't see what's so surprising here. That statement is identical to writing: if (arrMask[i] == 1) { numsels = ++numsels; } else { numsels = numsels; } and numsels = ++numsels; has two statements modifying the value of numsels (= and prefix-++) in a single sequ

Re: [Rd] operation on ‘numsels’ may be undefined

2014-06-23 Thread Kasper Daniel Hansen
I am not an expert on this, but I note that the section on -Wsequence-point at http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html specifically mentions ? and :. Perhaps some more work on tracking down their definitions and precedence might lead to insights. Best, Kasper On Mon, Jun 23, 20

Re: [Rd] operation on ‘numsels’ may be undefined

2014-06-23 Thread Hervé Pagès
On 06/23/2014 03:18 PM, Hervé Pagès wrote: Hi Christian, On 06/23/2014 11:54 AM, cstrato wrote: Dear Romain, I do not know enough about compilers, but as far as I remember, they 'work' from right to left, Not necessarily. So you should not rely on that. This is what the (somewhat obscure) wa

Re: [Rd] operation on ‘numsels’ may be undefined

2014-06-23 Thread Hervé Pagès
Hi Christian, On 06/23/2014 11:54 AM, cstrato wrote: Dear Romain, I do not know enough about compilers, but as far as I remember, they 'work' from right to left, Not necessarily. So you should not rely on that. This is what the (somewhat obscure) warning you see on zin1 is trying to tell you.

[Rd] Curious behavior of $ and lapply

2014-06-23 Thread Σταῦρος Μακράκης
There seems to be a funny interaction between lapply and "$" -- also, "$" doesn't signal an error in some cases where "[[" does. The $ operator accepts a string second argument in functional form: > `$`(list(a=3,b=4),"b") [1] 4 lapply(list(list(a=3,b=4)),function(x) `$`(x,"b")) [[1]] [1] 4 ...

Re: [Rd] operation on ‘numsels’ may be undefined

2014-06-23 Thread cstrato
Dear Kasper, What do you mean with 'undefined aspect of ++'? Every compiler has to evaluate first the expression on the right side and then apply the result to the variable on the left side, as in: i = i + 1; I understand that the expression: i = i++; may be confusing, but the expression

Re: [Rd] operation on ‘numsels’ may be undefined

2014-06-23 Thread Kasper Daniel Hansen
You're getting this message because you are using an undefined aspect of ++. Depending on compiler convention re. the interpretation of ++, your code may be interpreted differently; ie. different compilers will interpret the code differently. This is a bad thing. You're presumably getting the wa

Re: [Rd] operation on ‘numsels’ may be undefined

2014-06-23 Thread cstrato
Dear Romain, I do not know enough about compilers, but as far as I remember, they 'work' from right to left, so numsels = ++numsels should not confuse the compiler. Anyhow I will change my code to your first suggestion since it is more elegant. Best regards, Christian On 6/23/14 7:13 PM, R

Re: [Rd] operation on ‘numsels’ may be undefined

2014-06-23 Thread Romain François
Le 23 juin 2014 à 18:28, cstrato a écrit : > Dear Romain, > > Thank you for your suggestions, I like especially the first one. > > However, you did not explain why I have never got this warning message on any > compiler, and why only one of the two identical Ubuntu compilers did give > this

Re: [Rd] operation on ‘numsels’ may be undefined

2014-06-23 Thread cstrato
Dear Romain, Thank you for your suggestions, I like especially the first one. However, you did not explain why I have never got this warning message on any compiler, and why only one of the two identical Ubuntu compilers did give this warning message? Best regards, Christian On 6/23/14 3:

[Rd] Unfixed bugs in latest R-patched

2014-06-23 Thread Radford Neal
A new version of pqR is now available at pqR-project.org, which fixes several bugs that are also present in the latest R Core patch release (r66002). A number of bugs found previously during pqR development are also unfixed in the latest R Core release. Here is the list of these bugs that are unf

Re: [Rd] operation on ‘numsels’ may be undefined

2014-06-23 Thread Romain François
Le 23 juin 2014 à 15:20, cstrato a écrit : > Dear all, > > Since many years the following C++ code does compile on ALL Bioconductor > servers (Linux, Windows, Mac) without any warnings: > > Int_t numsels = 0; //number of selected entries > ... > for (Int_t i=0; i numsels = (arrMas

[Rd] operation on ‘numsels’ may be undefined

2014-06-23 Thread cstrato
Dear all, Since many years the following C++ code does compile on ALL Bioconductor servers (Linux, Windows, Mac) without any warnings: Int_t numsels = 0; //number of selected entries ... for (Int_t i=0; iEven on the recently added release server 'zin2' Linux (Ubuntu 12.04.4 LTS) the