As far as I can tell there is no way to have vec_c() return autoscaled units because:
- let's say we're combining
x and y
vctrs::vec_ptype2 finds the common type between x and y
vctrs::vec_cast() casts each x and y independently to the common type determined by vec_ptype2
- here's the rub:
vec_ptype2 DOES not get the whole vectors x and y with the data in it but only the object types (essentially whatever vec_slice(x, 0L) returns)
- here's the problem then: to determine the ideal auto-scaling for a combined
x and y we'd need to have the data so we can calculate the median and decide on the ideal prefix for the combined vector, neither vec_ptype2 nor vec_cast has all the information (vec_ptype2 has the units but not the actual numbers, vec_cast only has the units of one at a time) to do this correctly so I do not see any way for vec_c()/bind_rows to autoscale
- result:
vec_c() can only scale to the ideal prefix of one of the vectors (calculations are correct but autoscaling doesn't work)
Question then: currently c() does autoscale (because it has all the info and thus can) but should this be it's behaviour?? (leads to vec_c() and c() scaling differently)
As far as I can tell there is no way to have
vec_c()return autoscaled units because:xandyvctrs::vec_ptype2finds the common type betweenxandyvctrs::vec_cast()casts eachxandyindependently to the common type determined byvec_ptype2vec_ptype2DOES not get the whole vectorsxandywith the data in it but only the object types (essentially whatevervec_slice(x, 0L)returns)xandywe'd need to have the data so we can calculate the median and decide on the ideal prefix for the combined vector, neithervec_ptype2norvec_casthas all the information (vec_ptype2has the units but not the actual numbers,vec_castonly has the units of one at a time) to do this correctly so I do not see any way forvec_c()/bind_rowsto autoscalevec_c()can only scale to the ideal prefix of one of the vectors (calculations are correct but autoscaling doesn't work)Question then: currently
c()does autoscale (because it has all the info and thus can) but should this be it's behaviour?? (leads tovec_c()andc()scaling differently)