In R, I'm not sure how to build a list of lists. I have a number of lists that I'd like to combine into a single data structure to make accessing them easier. However, it appears that in R, you cannot utilise a list of lists, thus if I acquire list l1 from another list, say, l2, I won't be able to access the components of l1. How can I put it into practise?

EDIT: Here's an example of something that doesn't work for me:

list1 is a list of a list of a list of a list of ()

1 in list1[1]

2 in list1[2]

list2 - a list of a list of a list of a list ()

'a' in list2[1]

'b' in list2[2]

list all - a list of everything (list1, list2)

a = list all[1] a = list all[1] a = list all[

a[2]

#[[1]]

#NULL

However, it should be a list!
Jun 19, 2022 353 views

Lists of lists are simple to create.

list1 = list(a = 2, b = 3).
list2 – list(c = "a," d = "b"
list in mylist (list1, list2)
There are now two lists within of mylist. You can use mylist[[1]] to get list1. You must do the following actions if you want to be able to use anything like mylist\$list1.

list in mylist

Lists 1 and 2 are equal to one other. As of right now, you can
mylist\$list1
To comment on your edit. simply index using double brackets

list all[[1]] a
a[[1]]
#[1] 1 a[[2]]
#[1] 2
• 3,040 points

How do I make a matrix from a list of vectors in R?

Suppose l1 and l2 are my vectors, li = ...READ MORE

How to create dummy variables based on a categorical variable of lists in R?

You can use mtabulate in the following way: library(qdapTools) cbind(data[1], ...READ MORE

+1 vote

How to convert a list of dataframes in to a single dataframe using R?

You can use the plyr function: data <- ...READ MORE

How can I delete multiple values from a vector in R?

The %in% operator tells  which elements are ...READ MORE

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

The below is the code to perform ...READ MORE