Let's perform the following steps to create a list:
- The list() R function is used to create a list object. The dimension of a list could be any, and it can contain heterogeneous objects. To create a list called listA, execute the following code:
listA <- list(cVec, nVec, Lvec, matA, datA, arrayA)
- The list could be a named list or without a name. To create a named list, the syntax is similar to the creation of a named vector. Here is an example:
listB <- list(vector1 = cVec, vector2 = nVec, vector3 = Lvec, matrix1 = matA, data1 = datA, array1 = arrayA)
- The list preserves the original properties of the elements. To check the properties at a glance, you can use the str() function as follows:
str(listA) str(listB)
The ...