drsimonj / twidlr

data.frame-based API for model and predict functions
Other
59 stars 9 forks source link

Question: when would I use this? #29

Open andrewcstewart opened 5 years ago

andrewcstewart commented 5 years ago

Just curious, but why would I use this package instead of the following...

df %>%
    lm(y ~ x, data = .)

I'm reading https://drsimonj.svbtle.com/a-tidy-model-pipeline-with-twidlr-and-broom and trying to figure out what twidlr is doing differently.

drsimonj commented 5 years ago

Piping is a convenience of twidlr, but here are some of the more important reasons:

Hope these are a little more convincing!

andrewcstewart commented 5 years ago

Aha, I see. I saw reference to this lib in the context of a tinymodels workflow and was trying to figure out the relationship. I’ll def play around with this. Thanks!

On December 15, 2018 at 3:11:30 AM, Dr Simon Jackson ( notifications@github.com) wrote:

Piping is a convenience of twidlr, but here are some of the more important reasons:

  • It provides a consistent data-frame format for all models (where many require different formats like data frames, matrices, vectors, etc)
  • It allows formula method even in cases that it's not natively enabled
  • It requires predict to include a data set, avoiding some nasty traps like these https://gist.github.com/drsimonj/5b2cfc428fce350676db5dc77c059052
  • It lets you use predict for models that don't natively support it (like kmeans)

Hope these are a little more convincing!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/drsimonj/twidlr/issues/29#issuecomment-447560666, or mute the thread https://github.com/notifications/unsubscribe-auth/ABWtboPZzH7hKEev0LSqBxvxLp14yeK0ks5u5NjigaJpZM4Y0cu0 .