[R] substring simultaneous conditions
ulrik.stervbo at gmail.com
Mon Sep 5 14:41:57 CEST 2016
you can use grep for pattern matching along the lines of:
x <- c("000711111101", "000711111111", "000711111112","123456789123")
Here I assume that your real IDs consist of integers only. The pattern
matches two integers followed by 07 followed by 6 integers and finally 01
Hope this helps,
On Mon, 5 Sep 2016 at 13:54 Rosa Oliveira <rosita21 at gmail.com> wrote:
> Dear all,
> I have searched all over and didn´t found an answer :( Sorry, I'm new.
> I need urgently to "not analyse"the weight the ID's that have 07 in the
> position 3 and 4 respectively, 01 or 11 in positions 11 and 12 of ID
> variable. .
> I used the following code:
> But, instead of removing just the id's that respect the 3 conditions
> simultaneously, base don't have all the id's that have 03 in the 3 and 4
> positions os id variable, neither 01 in positions 11 and 12 of ID,
> neither 11
> in positions 11 and 12 of ID variable.variable.
> So, it seems, that the code exclude all the conditions, as it was a OR (|)
> condition in spite of AND (&) condition.
> Can anyone help me please?
> I attach the data.
> Rosa Oliveira
> Antes de imprimir este e-mail pense bem se tem mesmo que o fazer.
> Há cada vez menos árvores.
> Não imprima, pense na sua responsabilidade e compromisso com o MEIO
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help