A Data Structure Is A Particul
A Data Structure Is A Particul
Vectors
A vector is an ordered collection of basic data types of a given
length. The only key thing here is all the elements of a vector
must be of the identical data type e.g homogeneous data
structures. Vectors are one-dimensional data structures.
Example:
[1] 1 3 5 7 8
Lists
A list is a generic object consisting of an ordered collection of
objects. Lists are heterogeneous data structures. These are also
one-dimensional data structures. A list can be a list of vectors, list
of matrices, a list of characters and a list of functions and so on.
Example
# R program to illustrate a List
print(empList)
Output:
[[1]]
[1] 1 2 3 4
[[2]]
[1] "Debi" "Sandeep" "Subham" "Shiba"
[[3]]
[1] 4
Dataframes
Dataframes are generic data objects of R which are used to store
the tabular data. Dataframes are the foremost popular data
objects in R programming because we are comfortable in seeing
the data within the tabular form. They are two-dimensional,
heterogeneous data structures. These are lists of vectors of equal
lengths.
Example:
print(df)
Output: