Re: [Rd] large integer values

2014-05-14 Thread Adrian Dușa
On Wed, May 14, 2014 at 6:24 PM, Martyn Plummer wrote: > [...] > > Your numbers are being coerced to int when you print them. Try the > format ", %lld" instead. Oh my goodness, this was a printing issue...! (feeling embarrassed, but learned something new) Problem solved, thanks very much all,

[Rd] Bug in read.dcf(all = TRUE)?

2014-05-14 Thread Yihui Xie
Hi, read.dcf() can modify the locale variable LC_CTYPE, and here is a minimal example: > Sys.getlocale('LC_CTYPE') [1] "en_US.UTF-8" > read.dcf(textConnection('a: b'), all = TRUE) a 1 b > Sys.getlocale('LC_CTYPE') [1] "C" After diagnosing the problem, it seems the on.exit() call in read.dcf()

Re: [Rd] S3 - how to implement "colnames<-"

2014-05-14 Thread Charles Berry
Witold E Wolski gmail.com> writes: > > Have a class for which I would like to provide a "colnames<-.myclass" > function so that > > colnames(myintsance) <- c("a","b","c") > can be called. `colnames<-` is not generic as Luca noted. But `dimnames<-` is. If you write a suitable `dimnames<-.myi

Re: [Rd] large integer values

2014-05-14 Thread Martyn Plummer
On Wed, 2014-05-14 at 18:17 +0300, Adrian Dușa wrote: > On Wed, May 14, 2014 at 5:35 PM, Simon Urbanek > wrote: > > > [...] > > > > How do you print them? It seems like you're printing 32-bit value instead > > ... (powers of 2 are simply shifts of 1). > > > > > I am simply using Rprintf(): > >

Re: [Rd] large integer values

2014-05-14 Thread Adrian Dușa
On Wed, May 14, 2014 at 5:35 PM, Simon Urbanek wrote: > [...] > > How do you print them? It seems like you're printing 32-bit value instead > ... (powers of 2 are simply shifts of 1). > > I am simply using Rprintf(): long long int power[lgth]; power[lgth - 1] = 1; Rprintf("power: %d",

Re: [Rd] large integer values

2014-05-14 Thread Simon Urbanek
On May 14, 2014, at 8:41 AM, Adrian Dușa wrote: > Dear Prof. Ripley, > > Once again, thank you for your replies. > I must confess not being a genuine C programmer, having learned how to use > C only in connection to R (and the macros provided are almost a separate > language to learn). > > I'll

Re: [Rd] large integer values

2014-05-14 Thread Adrian Dușa
Dear Prof. Ripley, Once again, thank you for your replies. I must confess not being a genuine C programmer, having learned how to use C only in connection to R (and the macros provided are almost a separate language to learn). I'll try to read more about the types you've indicated, and will keep

Re: [Rd] large integer values

2014-05-14 Thread Prof Brian Ripley
On 14/05/2014 10:37, Adrian Dușa wrote: Dear devels, I need to create a (short) vector in C, which contains potentially very large numbers, exponentially to the powers of 2. This isn't an R question, except in so far that R mandates the usual convention of C being 32-bit. However 1) You s

Re: [Rd] [R] S3 - how to implement "colnames<-"

2014-05-14 Thread Luca Cerone
Hi Witold, you should first of all redefine colnames to use UseMethod. Then you have to write a colnames.default that uses base::colnames (so that it does not interfere with existing code and other functions) and the you can define the method for your class. I would suggest, though, to use attribu

[Rd] large integer values

2014-05-14 Thread Adrian Dușa
Dear devels, I need to create a (short) vector in C, which contains potentially very large numbers, exponentially to the powers of 2. This is my test example: lgth = 35; int power[lgth]; power[lgth - 1] = 1; for (j = 1; j < lgth; j++) { power[lgth - j - 1] = 2*power[lgth - j]; } Everything

Re: [Rd] legitimate use of :::

2014-05-14 Thread Knut Krueger
Am 14.05.2014 08:56, schrieb Deepayan Sarkar: On Wed, May 14, 2014 at 12:29 AM, Duncan Murdoch wrote: I think you are misunderstanding the comments in that file. It's an internal set of tests for the package, so "test some typical completion attempts" is a description of the tests that follow,

[Rd] S3 - how to implement "colnames<-"

2014-05-14 Thread Witold E Wolski
Have a class for which I would like to provide a "colnames<-.myclass" function so that colnames(myintsance) <- c("a","b","c") can be called. Witold -- Witold Eryk Wolski [[alternative HTML version deleted]] __ R-devel@r-project.org mailing