How to convert R dataframe rows to a list ?
In this article, we will see how to convert the rows of DataFrame to the list in R Programming Language.
We can convert a given data frame to a list by row we use the split() function. The split() function is used to split the data according to our requirement and the arguments given in the split() function are data itself and the other one is seq() function. The seq() function is used to generate the sequence of the data and in the seq() function we give one argument i.e. nrow() so, that the sequence is generated row-wise and in nrow() function we give the data as an argument.
Without using seq():
Example 2: In this example, mtcars data is used: