Skip to content
Back to formatted view

Raw Message

Message-ID: <20120220154553.GA30981@cs.cas.cz>
Date: 2012-02-20T15:45:53Z
From: Petr Savicky
Subject: How to determine a subset of a binary strings?
In-Reply-To: <003e01ccefd1$c6235770$526a0650$@fimm.fi>

On Mon, Feb 20, 2012 at 03:15:53PM +0200, jing tang wrote:
> Hi,
> 
> I need some neat ways of determing a subset of binary strings. For example,
> x=c(0,0,1), y=c(0,1,1), z=c(0,1,0). So x is a subset of y and z is also a
> subset of y, but x is not a subset of z.
> 
> I tried to search R functions and packages but no hits. Any ideas?

Hi.

Try this

  all(x <= y) # [1] TRUE
  all(z <= y) # [1] TRUE
  all(x <= z) # [1] FALSE

Hope this helps.

Petr Savicky.