natverse / neuprintr

R client utilities for interacting with the neuPrint connectome analysis service
http://natverse.org/neuprintr
3 stars 3 forks source link

should the neuprint_search `type` column be a factor? #47

Closed jefferis closed 4 years ago

jefferis commented 4 years ago

In one sense, it makes sense to have it as a factor (you will often have tables where multiple neurons have the same type). However, factors unless for very well defined sets of levels (think male / female) can trip people up. Specifically @alexanderbates has some code here that is broken

https://github.com/natverse/neuprintr/blob/007709c677fd923933a9707f9cb466bc79ee919b/vignettes/hemibrain_opns.Rmd#L90-L91

because he is trying to add new levels to a factor. It would work as is if type were a character vector. Thoughts also @romainFr?

jefferis commented 4 years ago

I have decided that neuprint_list2df will have stringsAsFactors=FALSE as a default i.e. always character vector rather than factor. Then you can choose to make a factor explicitly if you want. I think that in the above example type (and name) should not be factors.