 # R Program to create a list of elements using vectors, matrices and a functions

## How to create a list of elements using vectors, matrices, and a functions

Here we are explaining how to write an R program to create a list of elements using vectors, matrices, and functions. Here we are using a built-in function list() for this. This function helps to create a list. The syntax of this function is

``````list(…)
```
```

Where ....(dots)are the objects, possibly named.

## How to create a list of elements using vectors, matrices, and functions using R program

Below are the steps used in the R program to create a list of elements using vectors, matrices, and functions. In this R program, we directly give the values to a built-in function list(). Here we are using variables for holding the list elements. Call the function list() with different types of elements. Here month.abb is the three-letter abbreviations for the English month names. And asin helps to find the sine inverse of the given value. The returned angle is in the range -pi/2 through pi/2.Finally, print the list content.

## ALGORITHM

STEP 1: Assign variables L with a lists

STEP 2: include list of vectors

STEP 3 include list of months as month.abb

STEP 4: include list of matrix as matrix(c(3, -8, 1, -3), nrow = 2)

STEP 4: include sine inverse of value as asin

STEP 4: Finally print the list contents

## R Source Code

```                                          ```L = list(
c(1, 2, 3, 4, 5, 6),
month.abb,
matrix(c(3, -8, 1, -3), nrow = 2),
asin
)
print("Content of the list:")
print(L)```
```

## OUTPUT

``` "Content of the list:"
[]
  1  2  3  4  5 6

[]
 "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"

[]
[,1] [,2]
[1,]    3    1
[2,]   -8   -3

[]
function (x)  .Primitive("asin")    ```
VIEW ALL
VIEW ALL
##### OtherTutorials
VIEW ALL 