In this case (one level depth list) this should works too:
a[sapply(a, is.null)] <- NA
unlist(a)
# p1 p2 p1 p2 p1 p2 p1 p2
# 2 5 3 4 NA NA 4 5
In this case (one level depth list) this should works too:
a[sapply(a, is.null)] <- NA
unlist(a)
# p1 p2 p1 p2 p1 p2 p1 p2
# 2 5 3 4 NA NA 4 5