Dear all,

   Sorry to bother you with a question that must be a FAQ, but I'm not
clever enough to have Google give me the answer.

   I want to filter out some bytes that I read in a file, before applying
rawToChar (to prevent null character problems)

   So, I tried things like match("<some_byte>", my_raw_tab),   but this
didn't work.

   Here is a minimal example :

a <- charToRaw(paste("garbage", "\002", "some text", "\003", "garbage"))
print (a[9])
i <- match (02, a)
j <- match ('\002', a)
print (c(i, j))

  All I get as result of "match" calls are NA's, while print (a[9]) ensures
me that the ninth value of a is 2, indeed.

   Of course, hand-made search gives me the result :
for (i in seq(length(a)))
{
  if (a[i] == 2) {
    print (i)
  }
}

Any hints ?

Thanks in advance,

Bruno.
PS : R version 2.11.0 (2010-04-22)

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to