
The seq function is the most general, and allows you to specify sequences in many different ways.

The following commands are equivalent to the previous ones: numeric ( 5 ) # 0 0 0 0 0 complex ( 5 ) # 0+0i 0+0i 0+0i 0+0i 0+0i logical ( 5 ) # FALSE FALSE FALSE FALSE FALSE character ( 5 ) # "" "" "" "" ""īeyond the colon operator, there are several functions for creating more general sequences. For convenience, wrapper functions exist for each type to save you typing when creating vectors in this way.

We’ll look at NULL in detail in Chapter 5. In that last example, NULL is a special “empty” value (not to be confused with NA, which indicates a missing data point). Each of the values in the result is zero, FALSE, or an empty string, or whatever the equivalent of “nothing” is: vector ( "numeric", 5 ) # 0 0 0 0 0 vector ( "complex", 5 ) # 0+0i 0+0i 0+0i 0+0i 0+0i vector ( "logical", 5 ) # FALSE FALSE FALSE FALSE FALSE vector ( "character", 5 ) # "" "" "" "" "" vector ( "list", 5 ) # ] The vector function creates a vector of a specified type and length.

So far, you have used the colon operator, :, for creating sequences from one number to another, and the c function for concatenating values and vectors to create longer vectors.
