On 2/16/07, Jim Regetz [EMAIL PROTECTED] wrote:
Roland Rau wrote:
On 2/16/07, Petr Pikal [EMAIL PROTECTED] wrote:
Hi
slight modification of your function can be probably even quicker:
fff-function(x) sum(2^(which(rev(x))-1))
:-)
Petr
Yes, your function is slightly but
On 2/16/07, Petr Pikal [EMAIL PROTECTED] wrote:
Hi
slight modification of your function can be probably even quicker:
fff-function(x) sum(2^(which(rev(x))-1))
:-)
Petr
Yes, your function is slightly but consistently faster than my suggestion.
But my tests show still Bert Gunter's
Roland Rau wrote:
On 2/16/07, Petr Pikal [EMAIL PROTECTED] wrote:
Hi
slight modification of your function can be probably even quicker:
fff-function(x) sum(2^(which(rev(x))-1))
:-)
Petr
Yes, your function is slightly but consistently faster than my suggestion.
But my tests show still
Hello,
we need to convert a logical vector to a (decimal) integer. Example:
a=c(TRUE, FALSE, TRUE) (binary number 101)
the function we are looking for should return
dec2bin(a)=5
Is there a package for such a function or is it even implemented in the
base package? We found the hexmode and
On Thu, 2007-02-15 at 16:38 +0100, Martin Feldkircher wrote:
Hello,
we need to convert a logical vector to a (decimal) integer. Example:
a=c(TRUE, FALSE, TRUE) (binary number 101)
the function we are looking for should return
dec2bin(a)=5
Is there a package for such a function or is
That was a nice quick distraction. Unfortunately, I am not the first to
answer. :-(
Anyway, I offer two solutions (which are different from the one of Marc
Schwartz); I wrote it quickly but I hope they are correct.
Enjoy and thanks,
Roland
a - c(TRUE, FALSE, TRUE)
b - c(TRUE, FALSE, TRUE, TRUE)
: Thursday, February 15, 2007 8:22 AM
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] convert to binary to decimal
That was a nice quick distraction. Unfortunately, I am not the first to
answer. :-(
Anyway, I offer two solutions (which are different from the one of Marc
Schwartz
Subject: Re: [R] convert to binary to decimal
That was a nice quick distraction. Unfortunately, I am not the first to
answer. :-(
Anyway, I offer two solutions (which are different from the one of Marc
Schwartz); I wrote it quickly but I hope they are correct.
Enjoy and thanks,
Roland
, February 15, 2007 8:22 AM
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] convert to binary to decimal
That was a nice quick distraction. Unfortunately, I am not the
first to
answer. :-(
Anyway, I offer two
]
To: Bert Gunter [EMAIL PROTECTED]
Copies to: [EMAIL PROTECTED], r-help@stat.math.ethz.ch
Subject:Re: [R] convert to binary to decimal
Hi Bert,
First, I was very happy with my solution, but you win (see below)!
Best,
Roland
bert.gunter - function(x
10 matches
Mail list logo