JuliaStats / GLM.jl

Generalized linear models in Julia
Other
593 stars 114 forks source link

Order of columns in table triggers error #498

Open LinusSch opened 2 years ago

LinusSch commented 2 years ago
using GLM, TypedTables, CategoricalArrays
table1= Table( Value=[1.2,1.3,1.4,2.1,2.2,2.3],
               Group=categorical(["a","a","a","b","b","b"]) )
table2= Table( Group=table1.Group, Value=table1.Value )
lm( @formula( Value ~ Group ), table1 )  # this works as expected
lm( @formula( Value ~ Group ), table2 )  # this is an error, ends up trying to convert a String to a Float64

The same thing happens with DataFrames instead of TypedTables.

My version details:

  [324d7699] CategoricalArrays v0.10.6
  [a93c6f00] DataFrames v1.3.4
  [85a47980] Dictionaries v0.3.24
  [38e38edf] GLM v1.8.0
  [03a91e81] SplitApplyCombine v1.2.2
  [9d95f2ec] TypedTables v1.4.1