Diff'ing 2 strings

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Diff'ing 2 strings

Sebastien Bihorel
Hi,

Does R include an equivalent of the linux diff command?

Ideally I would like to diff 2 fairly complex strings and extract the differences without having to save them on disk and using a system('diff file1 file2') command.

Thanks

Sebastien

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

Bert Gunter-2
I do not know what you mean in your string context, as diff in Linux finds
lines in files that differ. A reproducible example -- posting guide! --
would be most useful here.

However, maybe something of the following strategy might be useful:

1. Break up your strings into lists of string "chunks" relevant for your
context via strspit() . Using "" (empty character) as the "sep" string
would break your strings into individual characters; "\n" would break it
into "lines" separated by the return
character; etc.

2. Compare your lists using e.g. lapply() and probably ?match and friends
like ?setdiff

You should also probably check out the stringr package to see if it
contains what you need. Also, if this is gene sequence related, posting on
the Bioconductor list rather than here is likely to be more fruitful.

Cheers,
Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, Jan 5, 2019 at 5:58 AM Sebastien Bihorel <
[hidden email]> wrote:

> Hi,
>
> Does R include an equivalent of the linux diff command?
>
> Ideally I would like to diff 2 fairly complex strings and extract the
> differences without having to save them on disk and using a system('diff
> file1 file2') command.
>
> Thanks
>
> Sebastien
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

Bert Gunter-2
It's the "split" string not the "sep" string, as you and probably everyone
else already realizes.
And, of course, it could be a regular expression, not literally a character
string.

-- Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, Jan 5, 2019 at 7:19 AM Bert Gunter <[hidden email]> wrote:

> I do not know what you mean in your string context, as diff in Linux finds
> lines in files that differ. A reproducible example -- posting guide! --
> would be most useful here.
>
> However, maybe something of the following strategy might be useful:
>
> 1. Break up your strings into lists of string "chunks" relevant for your
> context via strspit() . Using "" (empty character) as the "sep" string
> would break your strings into individual characters; "\n" would break it
> into "lines" separated by the return
> character; etc.
>
> 2. Compare your lists using e.g. lapply() and probably ?match and friends
> like ?setdiff
>
> You should also probably check out the stringr package to see if it
> contains what you need. Also, if this is gene sequence related, posting on
> the Bioconductor list rather than here is likely to be more fruitful.
>
> Cheers,
> Bert
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Sat, Jan 5, 2019 at 5:58 AM Sebastien Bihorel <
> [hidden email]> wrote:
>
>> Hi,
>>
>> Does R include an equivalent of the linux diff command?
>>
>> Ideally I would like to diff 2 fairly complex strings and extract the
>> differences without having to save them on disk and using a system('diff
>> file1 file2') command.
>>
>> Thanks
>>
>> Sebastien
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

Sebastien Bihorel
In reply to this post by Bert Gunter-2
Thanks

Sorry my mention of "fairly complex strings" was indeed a bit vague, indeed. My code is building strings that contain \n characters so something that could be thought about as multiline strings.

For comparing these strings, I was hoping to use something like the linux diff command which is smart enough to recognize these line chunks you mentioned and not just to a simple line-by-line comparison.

I saw a few thread mentioning ?adist. I will look into that.

Sebastien


From: "Bert Gunter" <[hidden email]>
To: "Sebastien Bihorel" <[hidden email]>
Cc: "R-help" <[hidden email]>
Sent: Saturday, January 5, 2019 10:19:42 AM
Subject: Re: [R] Diff'ing 2 strings

I do not know what you mean in your string context, as diff in Linux finds lines in files that differ. A reproducible example -- posting guide! -- would be most useful here.

However, maybe something of the following strategy might be useful:

1. Break up your strings into lists of string "chunks" relevant for your context via strspit() . Using "" (empty character) as the "sep" string would break your strings into individual characters; "\n" would break it into "lines" separated by the return
character; etc.

2. Compare your lists using e.g. lapply() and probably ?match and friends like ?setdiff

You should also probably check out the stringr package to see if it contains what you need. Also, if this is gene sequence related, posting on the Bioconductor list rather than here is likely to be more fruitful.

Cheers,
Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, Jan 5, 2019 at 5:58 AM Sebastien Bihorel < [ mailto:[hidden email] | [hidden email] ] > wrote:


Hi,

Does R include an equivalent of the linux diff command?

Ideally I would like to diff 2 fairly complex strings and extract the differences without having to save them on disk and using a system('diff file1 file2') command.

Thanks

Sebastien

______________________________________________
[ mailto:[hidden email] | [hidden email] ] mailing list -- To UNSUBSCRIBE and more, see
[ https://stat.ethz.ch/mailman/listinfo/r-help | https://stat.ethz.ch/mailman/listinfo/r-help ]
PLEASE do read the posting guide [ http://www.r-project.org/posting-guide.html | http://www.R-project.org/posting-guide.html ]
and provide commented, minimal, self-contained, reproducible code.





        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

Martin Møller Skarbiniks Pedersen
In reply to this post by Sebastien Bihorel
On Sat, Jan 5, 2019, 14:58 Sebastien Bihorel <
[hidden email] wrote:

> Hi,
>
> Does R include an equivalent of the linux diff command?
>

yes.
?rdiff

/martin

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

Gerrit Eichner
Don't you mean ?Rdiff ?

  Hth  --  Gerrit

---------------------------------------------------------------------
Dr. Gerrit Eichner                   Mathematical Institute, Room 212
[hidden email]   Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104          Arndtstr. 2, 35392 Giessen, Germany
http://www.uni-giessen.de/eichner
---------------------------------------------------------------------

Am 10.01.2019 um 08:35 schrieb Martin Møller Skarbiniks Pedersen:

> On Sat, Jan 5, 2019, 14:58 Sebastien Bihorel <
> [hidden email] wrote:
>
>> Hi,
>>
>> Does R include an equivalent of the linux diff command?
>>
>
> yes.
> ?rdiff
>
> /martin
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

tring
In reply to this post by Sebastien Bihorel
?Rdiff perhaps??
Troels

-----Oprindelig meddelelse-----
Fra: R-help <[hidden email]> På vegne af Martin Møller
Skarbiniks Pedersen
Sendt: 10. januar 2019 08:35
Til: Sebastien Bihorel <[hidden email]>
Cc: R mailing list <[hidden email]>
Emne: Re: [R] Diff'ing 2 strings

On Sat, Jan 5, 2019, 14:58 Sebastien Bihorel <
[hidden email] wrote:

> Hi,
>
> Does R include an equivalent of the linux diff command?
>

yes.
?rdiff

/martin

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

Martin Møller Skarbiniks Pedersen
In reply to this post by Gerrit Eichner
On Thu, 10 Jan 2019 at 09:23, Gerrit Eichner <
[hidden email]> wrote:

> Don't you mean ?Rdiff ?
>
>
Oh yes.
The unix/linux command diff uses the rdiff-algorithme and it seems that
Rdiff in R uses the exactly same algorithme.

Regards
Martin

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

Sebastien Bihorel
In reply to this post by Martin Møller Skarbiniks Pedersen
From which the diffobj package?


From: "Martin Møller Skarbiniks Pedersen" <[hidden email]>
To: "Sebastien Bihorel" <[hidden email]>
Cc: "R mailing list" <[hidden email]>
Sent: Thursday, January 10, 2019 2:35:15 AM
Subject: Re: [R] Diff'ing 2 strings



On Sat, Jan 5, 2019, 14:58 Sebastien Bihorel < [ mailto:[hidden email] | [hidden email] ] wrote:


Hi,

Does R include an equivalent of the linux diff command?




yes.
?rdiff

/martin


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

Jeff Newmiller
Just type

?Rdiff

it is in the preinstalled packages that come with R.

On January 10, 2019 7:35:42 AM PST, Sebastien Bihorel <[hidden email]> wrote:

>From which the diffobj package?
>
>
>From: "Martin Møller Skarbiniks Pedersen" <[hidden email]>
>To: "Sebastien Bihorel" <[hidden email]>
>Cc: "R mailing list" <[hidden email]>
>Sent: Thursday, January 10, 2019 2:35:15 AM
>Subject: Re: [R] Diff'ing 2 strings
>
>
>
>On Sat, Jan 5, 2019, 14:58 Sebastien Bihorel < [
>mailto:[hidden email] |
>[hidden email] ] wrote:
>
>
>Hi,
>
>Does R include an equivalent of the linux diff command?
>
>
>
>
>yes.
>?rdiff
>
>/martin
>
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>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.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

Sebastien Bihorel
Yep, I did. Got nothing. It does not come with R 3.4.3, which is the version I can use.

R CMD Rdiff comes with this version, but it is a shell command not a R function. It is meant for diff'ing R output.


----- Original Message -----
From: "Jeff Newmiller" <[hidden email]>
To: [hidden email], "Sebastien Bihorel" <[hidden email]>, "Martin Møller Skarbiniks Pedersen" <[hidden email]>
Cc: "R mailing list" <[hidden email]>
Sent: Thursday, January 10, 2019 10:49:15 AM
Subject: Re: [R] Diff'ing 2 strings

Just type

?Rdiff

it is in the preinstalled packages that come with R.

On January 10, 2019 7:35:42 AM PST, Sebastien Bihorel <[hidden email]> wrote:

>From which the diffobj package?
>
>
>From: "Martin Møller Skarbiniks Pedersen" <[hidden email]>
>To: "Sebastien Bihorel" <[hidden email]>
>Cc: "R mailing list" <[hidden email]>
>Sent: Thursday, January 10, 2019 2:35:15 AM
>Subject: Re: [R] Diff'ing 2 strings
>
>
>
>On Sat, Jan 5, 2019, 14:58 Sebastien Bihorel < [
>mailto:[hidden email] |
>[hidden email] ] wrote:
>
>
>Hi,
>
>Does R include an equivalent of the linux diff command?
>
>
>
>
>yes.
>?rdiff
>
>/martin
>
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>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.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

Duncan Murdoch-2
On 10/01/2019 11:38 a.m., Sebastien Bihorel wrote:
> Yep, I did. Got nothing. It does not come with R 3.4.3, which is the version I can use.
>
> R CMD Rdiff comes with this version, but it is a shell command not a R function. It is meant for diff'ing R output.

It's in the tools package, so ?tools::Rdiff should get what you want
even in that version.  But as you note, it isn't a general purpose diff
for character vectors, it is targeted at comparing R output files.

Duncan Murdoch

>
>
> ----- Original Message -----
> From: "Jeff Newmiller" <[hidden email]>
> To: [hidden email], "Sebastien Bihorel" <[hidden email]>, "Martin Møller Skarbiniks Pedersen" <[hidden email]>
> Cc: "R mailing list" <[hidden email]>
> Sent: Thursday, January 10, 2019 10:49:15 AM
> Subject: Re: [R] Diff'ing 2 strings
>
> Just type
>
> ?Rdiff
>
> it is in the preinstalled packages that come with R.
>
> On January 10, 2019 7:35:42 AM PST, Sebastien Bihorel <[hidden email]> wrote:
>>From which the diffobj package?
>>
>>
>> From: "Martin Møller Skarbiniks Pedersen" <[hidden email]>
>> To: "Sebastien Bihorel" <[hidden email]>
>> Cc: "R mailing list" <[hidden email]>
>> Sent: Thursday, January 10, 2019 2:35:15 AM
>> Subject: Re: [R] Diff'ing 2 strings
>>
>>
>>
>> On Sat, Jan 5, 2019, 14:58 Sebastien Bihorel < [
>> mailto:[hidden email] |
>> [hidden email] ] wrote:
>>
>>
>> Hi,
>>
>> Does R include an equivalent of the linux diff command?
>>
>>
>>
>>
>> yes.
>> ?rdiff
>>
>> /martin
>>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

Bert Gunter-2
In reply to this post by Sebastien Bihorel
It's the same thing. From ?Rdiff:

"Given two *R* output files, compute differences ignoring headers, footers
and some other differences."

Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, Jan 10, 2019 at 8:39 AM Sebastien Bihorel <
[hidden email]> wrote:

> Yep, I did. Got nothing. It does not come with R 3.4.3, which is the
> version I can use.
>
> R CMD Rdiff comes with this version, but it is a shell command not a R
> function. It is meant for diff'ing R output.
>
>
> ----- Original Message -----
> From: "Jeff Newmiller" <[hidden email]>
> To: [hidden email], "Sebastien Bihorel" <
> [hidden email]>, "Martin Møller Skarbiniks Pedersen" <
> [hidden email]>
> Cc: "R mailing list" <[hidden email]>
> Sent: Thursday, January 10, 2019 10:49:15 AM
> Subject: Re: [R] Diff'ing 2 strings
>
> Just type
>
> ?Rdiff
>
> it is in the preinstalled packages that come with R.
>
> On January 10, 2019 7:35:42 AM PST, Sebastien Bihorel <
> [hidden email]> wrote:
> >From which the diffobj package?
> >
> >
> >From: "Martin Møller Skarbiniks Pedersen" <[hidden email]>
> >To: "Sebastien Bihorel" <[hidden email]>
> >Cc: "R mailing list" <[hidden email]>
> >Sent: Thursday, January 10, 2019 2:35:15 AM
> >Subject: Re: [R] Diff'ing 2 strings
> >
> >
> >
> >On Sat, Jan 5, 2019, 14:58 Sebastien Bihorel < [
> >mailto:[hidden email] |
> >[hidden email] ] wrote:
> >
> >
> >Hi,
> >
> >Does R include an equivalent of the linux diff command?
> >
> >
> >
> >
> >yes.
> >?rdiff
> >
> >/martin
> >
> >
> >       [[alternative HTML version deleted]]
> >
> >______________________________________________
> >[hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >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.
>
> --
> Sent from my phone. Please excuse my brevity.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

R help mailing list-2
In reply to this post by Sebastien Bihorel
> args(tools::Rdiff)
function (from, to, useDiff = FALSE, forEx = FALSE, nullPointers = TRUE,
    Log = FALSE)
NULL
> version$version.string
[1] "R version 3.4.3 (2017-11-30)"

(The 'tools' package is not attached by default, so use ::.)
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Thu, Jan 10, 2019 at 8:39 AM Sebastien Bihorel <
[hidden email]> wrote:

> Yep, I did. Got nothing. It does not come with R 3.4.3, which is the
> version I can use.
>
> R CMD Rdiff comes with this version, but it is a shell command not a R
> function. It is meant for diff'ing R output.
>
>
> ----- Original Message -----
> From: "Jeff Newmiller" <[hidden email]>
> To: [hidden email], "Sebastien Bihorel" <
> [hidden email]>, "Martin Møller Skarbiniks Pedersen" <
> [hidden email]>
> Cc: "R mailing list" <[hidden email]>
> Sent: Thursday, January 10, 2019 10:49:15 AM
> Subject: Re: [R] Diff'ing 2 strings
>
> Just type
>
> ?Rdiff
>
> it is in the preinstalled packages that come with R.
>
> On January 10, 2019 7:35:42 AM PST, Sebastien Bihorel <
> [hidden email]> wrote:
> >From which the diffobj package?
> >
> >
> >From: "Martin Møller Skarbiniks Pedersen" <[hidden email]>
> >To: "Sebastien Bihorel" <[hidden email]>
> >Cc: "R mailing list" <[hidden email]>
> >Sent: Thursday, January 10, 2019 2:35:15 AM
> >Subject: Re: [R] Diff'ing 2 strings
> >
> >
> >
> >On Sat, Jan 5, 2019, 14:58 Sebastien Bihorel < [
> >mailto:[hidden email] |
> >[hidden email] ] wrote:
> >
> >
> >Hi,
> >
> >Does R include an equivalent of the linux diff command?
> >
> >
> >
> >
> >yes.
> >?rdiff
> >
> >/martin
> >
> >
> >       [[alternative HTML version deleted]]
> >
> >______________________________________________
> >[hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >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.
>
> --
> Sent from my phone. Please excuse my brevity.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Diff'ing 2 strings

Sebastien Bihorel
In reply to this post by Duncan Murdoch-2

Thanks for the clarification.

----- Original Message -----
From: "Duncan Murdoch" <[hidden email]>
To: "Sebastien Bihorel" <[hidden email]>, "Jeff Newmiller" <[hidden email]>
Cc: [hidden email]
Sent: Thursday, January 10, 2019 11:43:14 AM
Subject: Re: [R] Diff'ing 2 strings

On 10/01/2019 11:38 a.m., Sebastien Bihorel wrote:
> Yep, I did. Got nothing. It does not come with R 3.4.3, which is the version I can use.
>
> R CMD Rdiff comes with this version, but it is a shell command not a R function. It is meant for diff'ing R output.

It's in the tools package, so ?tools::Rdiff should get what you want
even in that version.  But as you note, it isn't a general purpose diff
for character vectors, it is targeted at comparing R output files.

Duncan Murdoch

>
>
> ----- Original Message -----
> From: "Jeff Newmiller" <[hidden email]>
> To: [hidden email], "Sebastien Bihorel" <[hidden email]>, "Martin Møller Skarbiniks Pedersen" <[hidden email]>
> Cc: "R mailing list" <[hidden email]>
> Sent: Thursday, January 10, 2019 10:49:15 AM
> Subject: Re: [R] Diff'ing 2 strings
>
> Just type
>
> ?Rdiff
>
> it is in the preinstalled packages that come with R.
>
> On January 10, 2019 7:35:42 AM PST, Sebastien Bihorel <[hidden email]> wrote:
>>From which the diffobj package?
>>
>>
>> From: "Martin Møller Skarbiniks Pedersen" <[hidden email]>
>> To: "Sebastien Bihorel" <[hidden email]>
>> Cc: "R mailing list" <[hidden email]>
>> Sent: Thursday, January 10, 2019 2:35:15 AM
>> Subject: Re: [R] Diff'ing 2 strings
>>
>>
>>
>> On Sat, Jan 5, 2019, 14:58 Sebastien Bihorel < [
>> mailto:[hidden email] |
>> [hidden email] ] wrote:
>>
>>
>> Hi,
>>
>> Does R include an equivalent of the linux diff command?
>>
>>
>>
>>
>> yes.
>> ?rdiff
>>
>> /martin
>>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.