renkun-ken / rlist

A Toolbox for Non-Tabular Data Manipulation
Other
202 stars 28 forks source link

Removing the last element of a list causes error. #120

Open alexsanjoseph opened 7 years ago

alexsanjoseph commented 7 years ago

When I try to remove the last element of a list, I expect rlist to return an empty list list(). However, it errors out. Is this by design?

list("a" = c(1,2,3)) %>% rlist::list.remove("a") Error in apply(m, 1L, any) : dim(X) must have a positive length

dan-reznik commented 6 years ago

Also removing a non-existent element from a length-1 list also causes an error:

list(a=1,b=2) %>>% list.remove("c") # works! (returns input list)
list(a=1) %>>% list.remove("c") # throws an error! :^(