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