[R] how to make this sequence: 1,2,3,4,5,4,3,2,1

j verzani jverzani at gmail.com
Fri Mar 5 23:35:15 CET 2010

kensuguro <magronbass <at> gmail.com> writes:

> so basically, it's impossible to do with just seq() and rep()..  Doesn't seem
> like a good question for chapter 1...
> Also, problem 1.13 is even more crazy..  it asks you to build the fibonacci
> sequence.  Now I'm a programmer, and so went way ahead in the book to see
> how functions were written, and just wrote my own function, but again, in
> chapter 1?  (only covered c(), seq(), and rep() at this point)  What away
> kick start a book.  Is "Using R project for Introductory Statistics" known
> to jump around or have out of sequence practice problems?  Otherwise it
> seems to be written very well.

Sorry about that one. On the errata page I have:

page 16, exercise 1.12 #5
    This one is most easily done using c() and the sequence operator :. (Please
ignore request to use just seq and rep.) 

As for 1.13, I just wanted someone to use c() for that one. I don't even define
the Fibonacci sequence, I only wanted some context to a sequence of numbers that
is not an arithmetic progression.

Not sure if the rest of the book "jumps around", but if it seems to to you, I'm
very open to comments about improvements. Just email.


More information about the R-help mailing list