Home Forums R Programming Talks How to create vectors in R is the seq function?

Tagged: 

This topic contains 0 replies, has 1 voice, and was last updated by  blogger rajeev 3 months, 2 weeks ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #844

    blogger rajeev
    Keymaster

    seq function creates a sequence of numbers.
    seq {base}
    Sequence Generation

    Description

    Generate regular sequences. seq is a standard generic with a default method. seq.int is a primitive which can be much faster but has a few restrictions. seq_along and seq_len are very fast primitives for two common cases.

    Usage

    seq(…)

    ## Default S3 method:
    seq(from = 1, to = 1, by = ((to – from)/(length.out – 1)),
    length.out = NULL, along.with = NULL, …)

    seq.int(from, to, by, length.out, along.with, …)

    seq_along(along.with)
    seq_len(length.out)

    example :-Try typing seq(0,100,2).
    Close the parentheses and hit Enter.
    This gives a sequence of numbers from 0 to 100,
    starting at zero, the first argument to the seq function,
    ending at 100, the second argument to the seq function,
    and the numbers are in increments of two,
    the third argument to the seq function.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.