I want to generate the vector of integers in R but I am getting the vector of numeric

Z<-c(1,2,3,4)

class(Z)

[1] “numeric”

# How to generate vector of integer in R

**sid100158**#1

You can use `Z <- 1:4`

or any sequence with the `seq(1, 4)`

type of function using integers as arguments.

Or you can coerce the existing object to class “integer” with `Z2 <- as.integer(Z)`

.

A third option is to specify integer values with a capital letter “L” attached to each number: `Z <- c(1L, 2L, 3L, 4L)`

.