[R] String question

2006-11-29 Thread Carmen Meier
Hi to all I would to determinate whether bits is a binary code and I would to find out the which bit is set to 1 bits -00110110 I found to detect whether there are only numbers all.digits(bits) but is there any function to detect whether there are only 0 and 1 in the string And how could I get

Re: [R] String question

2006-11-29 Thread Romain Francois
Carmen Meier wrote: Hi to all I would to determinate whether bits is a binary code and I would to find out the which bit is set to 1 bits -00110110 I found to detect whether there are only numbers all.digits(bits) but is there any function to detect whether there are only 0 and 1 in the

Re: [R] String question

2006-11-29 Thread John Fox
://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Carmen Meier Sent: Wednesday, November 29, 2006 9:06 AM To: R-help Subject: [R] String question Hi to all I would to determinate whether bits

Re: [R] String question

2006-11-29 Thread Petr Pikal
On 29 Nov 2006 at 15:06, Carmen Meier wrote: Date sent: Wed, 29 Nov 2006 15:06:08 +0100 From: Carmen Meier [EMAIL PROTECTED] To: R-help r-help@stat.math.ethz.ch Subject:[R] String question Hi to all I would to determinate whether

Re: [R] String question

2006-11-29 Thread Gabor Grothendieck
Try: # TRUE if all 0 and 1 regexpr(^[01]*$, bits) 0 # positions of 1s gregexpr(1, bits)[[1]] On 11/29/06, Carmen Meier [EMAIL PROTECTED] wrote: Hi to all I would to determinate whether bits is a binary code and I would to find out the which bit is set to 1 bits -00110110 I found to