I have a situation where I need to test whether a variable is factor(0)
but any logical test (including comparing to NULL) I try to assign to it gives logical(0)
. How do I test if something is an empty factor?
edit: allow me to elaborate.
I have a function and it looks at the attribute of the vector that it takes in, but not every vector has that the attribute, so for vectors that don't have the attribute, when I query the attribute attr(vector,"attribute")
my return is factor(0) but when I compare that to 0 I get logical(0)
and comparing it to null or NA also won't work. Any ideas?
I was able to use length==0
thanks for the help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With