In R, when I add an empty list to the list, it is not actually added, as shown below:
a = list() a[[1]] = c() print(length(a))
length(a) 0 will be printed in this case, and if I change the 2nd line to a[[1]] = c(1) , then the length of the list will be 1, as expected. In my implementation, I need the length of the list that needs to be changed, even if I add an empty list to the list. Is there any way to do this?
source share