I have the following data:

```
t = seq(0, 0.45, 0.05)
d = c(0, 0.028, 0.055, 0.111, 0.202, 0.295, 0.435, 0.589, 0.771, 0.980)
```

This is for physics. `t`

represents time and `d`

represents displacement:

Time (s) | Displacement (m) |
---|---|

0.00 | 0.000 |

0.05 | 0.028 |

0.10 | 0.055 |

0.15 | 0.111 |

0.20 | 0.202 |

0.25 | 0.295 |

0.30 | 0.435 |

0.35 | 0.589 |

0.40 | 0.771 |

0.45 | 0.980 |

In the Desmos graphing calculator, I can simply insert the above table and then add the expression `y1 ~ 0.5 ax1^2`

where `x1`

is `t`

(time) and `y1`

is `d`

(displacement). What it will do is draw a curve of best fit and then give me the value for acceleration. *I want to do the same thing with ggplot2.*

```
library(ggplot2)
ggplot(data.frame(t, d), aes(x = t, y = d)) +
theme_linedraw() + theme(plot.title = element_text(hjust = 0.5)) +
geom_smooth() + geom_point()
```

This is the result:

It is almost exactly what I want, but I want a label somewhere in the graph to show what the acceleration is similar to what I did in Desmos. Also, I want to use the same equation I used in Desmos for the regression curve (`y1 ~ 0.5 ax1^2`

). I know that `geom_smooth()`

takes the argument `formula`

but it gave me an error when trying to use that.