How to fit a smooth curve to my data in R?

前端 未结 8 1915
无人共我
无人共我 2020-11-29 15:59

I\'m trying to draw a smooth curve in R. I have the following simple toy data:

> x
 [1]  1  2  3  4  5  6  7  8  9 10
> y
 [1]  2  4  6  8         


        
8条回答
  •  感情败类
    2020-11-29 16:39

    the qplot() function in the ggplot2 package is very simple to use and provides an elegant solution that includes confidence bands. For instance,

    qplot(x,y, geom='smooth', span =0.5)
    

    produces enter image description here

提交回复
热议问题