Re: [Rd] CXX_STD and configure.ac in packages

2014-03-31 Thread Martyn Plummer
Hi Martin, Thanks for the patch. I have applied it. I also added CXX1X and friends to the list of approved variables for R CMD config. So you can now query the existence of C++11 support with `R CMD config CXX1X` (It is empty if C++11 support is not available) and then take appropriate action in

Re: [Rd] rgl question

2014-03-31 Thread Duncan Murdoch
On 30/03/2014, 9:20 PM, Dominick Samperi wrote: Hello, If I call lines3d(x,y,z) I get lines connecting each point, but when I call rgl.lines(x,y,z) I get dashed lines, and adding something like type='l' leads to an error message. The docs seem to suggest that rgl.lines() calls lines3d(), so I wo

Re: [Rd] CXX_STD and configure.ac in packages

2014-03-31 Thread Martyn Plummer
On Mon, 2014-03-31 at 07:09 +, Martyn Plummer wrote: > Hi Martin, > > Thanks for the patch. I have applied it. I also added CXX1X and friends to > the list of approved variables for R CMD config. > So you can now query the existence of C++11 support with `R CMD config CXX1X` > (It is empty i

Re: [Rd] CXX_STD and configure.ac in packages

2014-03-31 Thread Romain François
Le 31 mars 2014 à 12:20, Martyn Plummer a écrit : > On Mon, 2014-03-31 at 07:09 +, Martyn Plummer wrote: >> Hi Martin, >> >> Thanks for the patch. I have applied it. I also added CXX1X and friends to >> the list of approved variables for R CMD config. >> So you can now query the existence o

Re: [Rd] CXX_STD and configure.ac in packages

2014-03-31 Thread Martin Morgan
On 03/31/2014 04:30 AM, Romain François wrote: Le 31 mars 2014 à 12:20, Martyn Plummer a écrit : On Mon, 2014-03-31 at 07:09 +, Martyn Plummer wrote: Hi Martin, Thanks for the patch. I have applied it. I also added CXX1X and friends to the list of approved variables for R CMD config. So

Re: [Rd] internal string comparison (Scollate)

2014-03-31 Thread Romain François
Hello, The use case I have might involve sorting many small such STRSXP vectors. If I have Scollate, I don’t need to materialize the vectors and I can use the sorting algorithm I choose. Here is some made up data: df <- data.frame( x = sample( 1:10, 1000, replace = TRUE), y = sample(

Re: [Rd] rgl question

2014-03-31 Thread Dominick Samperi
Thanks for the comment. No, there were no such prior calls, unless rgl.lines() itself sets lty to dashed? Here is a simple session run under Windows: library(rgl) x <- 1:20 y <- 1:20 z <- 1:20 rgl.lines(x,y,z) # displays dashed line lines3d(x,y,z) # displays solid line I'm using R 3.1.0 alpha O

Re: [Rd] rgl question

2014-03-31 Thread Duncan Murdoch
On 31/03/2014 12:56 PM, Dominick Samperi wrote: Thanks for the comment. No, there were no such prior calls, unless rgl.lines() itself sets lty to dashed? Here is a simple session run under Windows: library(rgl) x <- 1:20 y <- 1:20 z <- 1:20 rgl.lines(x,y,z) # displays dashed line lines3d(x,y,z)

[Rd] C API to get numrow of data frame

2014-03-31 Thread Sandip Nandi
Hi , Is there any C API to the R API nrow of dataframe ? x<- data.frame() n<- nrow(x) print(n) 0 Example : My C function which deals with data frame looks like and I don't to send the number of rows of data frame .I want to detect it from the function itself, my function take data frame as ar

Re: [Rd] C API to get numrow of data frame

2014-03-31 Thread Murray Stokely
The simplest case would be: int num_rows = Rf_length(VECTOR_ELT(dataframe, 0)); int num_columns = Rf_length(dataframe); There may be edge cases for which this doesn't work; would need to look into how the dim primitive is implemented to be sure. - Murray On Mon, Mar 31, 20

Re: [Rd] C API to get numrow of data frame

2014-03-31 Thread Sandip Nandi
Hi Murray, Thanks a lot . For things to work Its good enough . Its working Thanks, Sandip On Mon, Mar 31, 2014 at 5:04 PM, Murray Stokely wrote: > The simplest case would be: > >int num_rows = Rf_length(VECTOR_ELT(dataframe, 0)); >int num_columns = Rf_length(dataframe); > > There may

Re: [Rd] C API to get numrow of data frame

2014-03-31 Thread Gábor Csárdi
I think it is actually better to check the length of the row names. In case the data frame has zero columns. (FIXME, of course.) Gabor On Mon, Mar 31, 2014 at 8:04 PM, Murray Stokely wrote: > The simplest case would be: > >int num_rows = Rf_length(VECTOR_ELT(dataframe, 0)); >int num_co

Re: [Rd] C API to get numrow of data frame

2014-03-31 Thread Sandip Nandi
The Rf_length(dataframe) will provide the length of row names . So it should be checked first. I found one edge case now My dataframe has 0 rows and 0 columns int num_rows = Rf_length(VECTOR_ELT(dataframe, 0)); > returns 1 ,in stead of 0 . Not sure why. Thanks On Mon, Mar 31, 2014 at

Re: [Rd] C API to get numrow of data frame

2014-03-31 Thread Murray Stokely
I didn't look at the names because I believe that would be incorrect if the row names were stored internally in the compact form. See ?.set_row_names (hat tip, Tim Hesterberg who showed me this years ago) : 'row.names' can be stored internally in compact form. '.set_row_names(n)' genera

Re: [Rd] C API to get numrow of data frame

2014-03-31 Thread Kevin Ushey
The safest way is to check the length of the row.names attribute, e.g. length(getAttrib(df, R_RowNamesSymbol)). This protects you from both data.frames with zero columns, as well as corrupted data.frames containing columns with different lengths, since by definition the number of rows in a da