Can one extract model fit parameters after a ggplot stat_smooth call?

后端 未结 1 1570
忘了有多久
忘了有多久 2020-12-19 19:42

Using stat_smooth, I can fit models to data. E.g.

g=ggplot(tips,aes(x=tip,y=as.numeric(unclass(factor(tips$sex))-1))) +facet_grid(time~.) 
g=g+          


        
相关标签:
1条回答
  • 2020-12-19 20:26

    No, because the models are only created when the plot is rendered. However, it's usually pretty easy to do it yourself with plyr.

    Why do you want to convert sex to a number? Using as.numeric should be enough by itself, but if you're going to do the subtraction in the model you'll need to surround it with I().

    0 讨论(0)
提交回复
热议问题