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

2018-12-18 Thread Rui Barradas
Hello, Yet another option is ?cat. msg <- c("is not between 1 or 15", "is *not* 6 - 9 inclusive, nor is it 12", "falls within 6 - 9 inclusively, or is 12", "is *not* 6 - 9 inclusive, nor is it 12", "is not between 1 or 15") nums <-

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

2018-12-18 Thread Ivan Krylov
On Tue, 18 Dec 2018 08:56:23 + Andrew 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

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

2018-12-18 Thread Eric Berger
I often use sprintf() to control formatting of text strings. e.g. sprintf("%s is not between 1 or 15\n",nums) See ?sprintf for details HTH, Eric On Tue, Dec 18, 2018 at 10:56 AM Andrew wrote: > Hi all > > Playing around with some branching using if, if else, and else, I wrote > the

[R] Help with if else branching print out

2018-12-18 Thread Andrew
Hi all Playing around with some branching using if, if else, and else, I wrote the following very basic script: [code block] ## Take single value input from user: # Note 'as.integer' to convert character vector to numeric for testing nums <- (as.numeric(readline("Please enter a number