 # R Program to create a two-dimensional 5×3 array of sequence of even integers

## How to create a two-dimensional 5×3 array of a sequence of even integers

Here we are explaining how to write an R program to create a two-dimensional 5×3 array of a sequence of even integers greater than 50. Here we are using a built-in function array() for this. This function helps to create the array. The syntax of this function is

``````array(data = NA, dim = length(data), dimnames = NULL)
```
```

Where data is a vector giving data to fill the array. The dim is the dim attribute for the array to be created and dimnames are either NULL or the names for the dimensions.

## How to create a two-dimensional 5×3 array of a sequence of even integers using the R program

Below are the steps used in the R program to create a two-dimensional 5×3 array of a sequence of even integers. In this R program, we directly give the values to an array. Here we are using variable Arr for holding the list elements. Here we are displaying a 5x3 array of integers greater than 50 in length 15(means number of elements in the array is 15) and the difference between the elements is 2 . Finally, print the array.

## ALGORITHM

STEP 1: Assign array elements into the variable Arr

STEP 2: The sequence of elements are created by using seq()

STEP 3:limit the count to 15 as length.out = 15 and the numbers should be even,

difference between the numbers is 2 as by=2

STEP 4: Print the 5x3 array

## R Source Code

```                                          ```Arr<- array(seq(from = 50, length.out = 15, by = 2), c(5, 3))
print("Content of the array is:")
print("5 X 3 array of sequence of even integers greater than 50:")
print(Arr)```
```

## OUTPUT

``` "Content of the array is:"
 "5 X 3 array of sequence of even integers greater than 50:"
[,1] [,2] [,3]
[1,]   50   60   70
[2,]   52   62   72
[3,]   54   64   74
[4,]   56   66   76
[5,]   58   68   78   ```
VIEW ALL
VIEW ALL
VIEW ALL