[R] Python difflib R equivalent?
Bert Gunter
gunter.berton at gene.com
Thu Jul 28 17:05:05 CEST 2011
Paul:
1. I do not know if any such library exists.
2. However, if I understand correctly, one usually does this sort of
thing in R with functions like ?match (or ?"%in%") and logical
comparison operations like ?"==" . Of course, for numeric
comparisons, you need to be aware of R FAQ 7.31
If you are interested in comparing what in R are character vectors,
then various string operators, e.g. ?grep, ?regexp and character
operation packages (e.g. gsubfn, stringr) may be of use.
As usual, you are more likely to receive a helpful answer if you do as
the posting guide requests and provide a small, reproducible example
of the sort(s) of thing(s) you want to do.
Cheers,
Bert
On Thu, Jul 28, 2011 at 4:05 AM, Paul <newzealandspaul at gmail.com> wrote:
> Hi,
>
> Does anyone know of a R library that is equivalent in functionality to
> the Python standard libraries' difflib library? The python docs say
> this about difflib:
>
> "This module provides classes and functions for comparing sequences.
> It can be used for example, for comparing files, and can produce
> difference information in various formats, including HTML and context
> and unified diffs."
>
> http://docs.python.org/library/difflib.html
>
> Thanks,
>
> Paul
>
> ______________________________________________
> R-help at 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.
>
--
"Men by nature long to get on to the ultimate truths, and will often
be impatient with elementary studies or fight shy of them. If it were
possible to reach the ultimate truths without the elementary studies
usually prefixed to them, these would not be preparatory studies but
superfluous diversions."
-- Maimonides (1135-1204)
Bert Gunter
Genentech Nonclinical Biostatistics
More information about the R-help
mailing list