[R] [Solved] Re: Help with if else branching print out

Andrew ph@edru@v @ending from gm@il@com
Tue Dec 18 16:01:02 CET 2018


Dear Eric, Ivan & Rui

Thanks all for your suggestions. FWIW, I've opted to use paste0 and 
after a bit of playing around found it formatted the output nicely.

Eric, I wasn't aware of sprintf - seems a handy function to format text 
with, so will try to remember that.
Ivan, I'll dig into 'message' a little more, so that's a good one to know.
Rui, I liked the idea of the output vector and indexing - that will be 
useful for longer/ more complicated branching

Thank you all again.

Best wishes
Andrew


On 18/12/2018 09:25, Ivan Krylov wrote:
> On Tue, 18 Dec 2018 08:56:23 +0000
> Andrew <phaedrusv using gmail.com> wrote:
>
>> How do I:
>>
>> (a) reduce the gap between the reported number (i.e., 17, 9, 13) in
>> each of the lines? and
>>
>> (b) ensure that in the case of the second run using 9 as the input,
>> the print is not over two lines?
> Build a single string from your string parts. ?sprintf has already been
> mentioned; another option is ?paste.
>
> To prevent strings from being printed in quotes, use ?message.
>



More information about the R-help mailing list