[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] R code block produces only partial output
From: |
Nick Dokos |
Subject: |
Re: [O] R code block produces only partial output |
Date: |
Tue, 05 Aug 2014 16:10:34 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
Nick Dokos <address@hidden> writes:
> John Hendy <address@hidden> writes:
>
>> On Tue, Aug 5, 2014 at 2:02 PM, Eric Schulte <address@hidden> wrote:
>>> Charles Berry <address@hidden> writes:
>>>
>>>> Eric Schulte <schulte.eric <at> gmail.com> writes:
>>
>> [snip]
>>
>>>> Eric,
>>>>
>>>> As noted by Andreas and John this is a problem for session output.
>>>>
>>>> org-babel-R-evaluate-session uses
>>>>
>>>> (string-match "^\\([ ]*[>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line)
>>>>
>>>> to find the start of R output in the session.
>>>>
>>>> This does not match the ` 0', but matches the ` .6'
>>>> in the output you show above, so if that had been in a session, all the
>>>> output up to and including the '.' before the '6' would be clipped
>>>> by the following
>>>>
>>>> (substring line (match-end 1))
>>>>
>>>>
>>>> as Andreas output showed.
>>>>
>>>> Deleting the "\\." fixes Andreas case, but what are the circumstances
>>>> requiring the "\\." ?
>>>>
>>>
>>> I don't know.
>>
>> I'm not sure either, but was curious if someone could translate the
>> regex into "plain language." Maybe I could observe some typical
>> outputs and chime in since I use R regularly? From noob-level regex
>> stuff, it's looking for a new line followed by some number of spaces,
>> a ">" and at least one period and numbers?
>>
>
> It says[fn:1]
>
> ^ anchor the match at the beginning of the line
>
> \\([ ]*[>+\\.][ ]?\\)+ match any number of spaces followed by one of
> the three characters >, + or . (a literal
> period) followed by 0 or 1 space. If there is
> a match, remember what is matched as group 1
> (that's what the escaped parentheses
> \\(...\\) do). Match one or more of these
> (that's what the + at the end does).
>
> \\([[0-9]+\\|[ ]\\) match either an emtpy space or a sequence
> of one or more of the characters [ or 0-9
> i.e. an opening square bracket or a digit.
> remember what is matched as group 2.
>
> The latter will match [0[1[2[3 e.g. which does not sound right.
>
> The best way to find out what a regexp will match is to start with
> a buffer containing example strings that you are trying to match
> and example string that you are trying *not* to match, then invoke
>
> M-x regexp-builder
>
> and paste the regexp inside the empty set of quotes, then check the highligted
> matches to see if they agree with your expectations.
>
> Footnotes:
>
> [fn:1] Crossing fingers and toes, hoping I've got it right...
Bah, got it wrong: backslash is not special within a character class, so
[>+\\.]
matches > or + or \ or . (a period - which is also not special in a
character class).
I'm not sure what the regexp is supposed to match, but I'm almost sure
that it is wrong :-)
--
Nick
- Re: [O] R code block produces only partial output, (continued)
- Re: [O] R code block produces only partial output, Eric Schulte, 2014/08/04
- Re: [O] R code block produces only partial output, Charles Berry, 2014/08/05
- Re: [O] R code block produces only partial output, Eric Schulte, 2014/08/05
- Re: [O] R code block produces only partial output, John Hendy, 2014/08/05
- Re: [O] R code block produces only partial output, Nick Dokos, 2014/08/05
- Re: [O] R code block produces only partial output,
Nick Dokos <=
- Re: [O] R code block produces only partial output, Charles C. Berry, 2014/08/05
- Re: [O] R code block produces only partial output, Aaron Ecay, 2014/08/05
- Re: [O] R code block produces only partial output, Eric Schulte, 2014/08/06
- Re: [O] R code block produces only partial output, Aaron Ecay, 2014/08/07
- Re: [O] R code block produces only partial output, Charles C. Berry, 2014/08/07
- Re: [O] R code block produces only partial output, Aaron Ecay, 2014/08/07
- Re: [O] R code block produces only partial output, Charles C. Berry, 2014/08/07
- Re: [O] R code block produces only partial output, Thomas S. Dye, 2014/08/07
- Re: [O] R code block produces only partial output, Rainer M Krug, 2014/08/09
- Re: [O] R code block produces only partial output, Aaron Ecay, 2014/08/16