PSA: breaking changes in StatsModels v0.6.0 (Terms 2.0: Son of Terms)

Hi. Thanks for your work! I have a few questions about the new system.

  1. How to only create a ModelMatrix only for rows that do not contain an Inf due to a transformation? For instance, in the following code, the ModelMatrix gets an Inf due to the log transformation:

    using DataFrames
    df = DataFrame( y = [2, 2], x = [0, 1])
    ModelMatrix(ModelFrame(@formula(y~log(x)), df))
    #> ModelMatrix{Array{Float64,2}}([1.0 -Inf; 1.0 0.0], [1, 1])
    

    One way to get a ModelMatrix without the Inf would be to subset the initial ModelMatrix, but this would require the user to have enough RAM to hold 3 diffferent copies of the data. Is it possible to avoid it?

  2. How to create a Term/Tuple of Term from a Expression expr = :(x1 + x2 + x3+x4)? For now I do @eval(@formula(nothing ~ $expr)).rhs but maybe there is a more elegant way to do this?