vertesy / TheCorvinas

Various Scripts and Summaries
http://vertesy.github.io/TheCorvinas
2 stars 0 forks source link

as.named.vector loses NULL elements #5

Closed vertesy closed 8 years ago

vertesy commented 8 years ago

"A known issue is if a vector element is NULL, you lose it. Then the length of the vector"

vertesy commented 8 years ago

It looks like vectors cannot have NULL elements - so the issue is not with unlist, but with its vector output

c( a='', b=NULL, c='T')
  a   c 
 "" "T" 

Lists can, but when unlisted to a vec, they lose the NULL element

 list( a='', b=NULL, c='T')

as.vector does not do the job:

  is(as.vector(list( a='', b=NULL, c='T')))