Realizar algunos gráficos con ggplot2
library(ggplot2)
\[ f(x)=1-\frac {x}{2} \]
datos=data.frame(x=c(-2 ,-1 ,0 ,1 ,2 ,3), y=c(0 ,0 ,1 ,0.5 ,0 ,0)) datos
x y 1 -2 0.0 2 -1 0.0 3 0 1.0 4 1 0.5 5 2 0.0 6 3 0.0
g=ggplot() g
g=ggplot(data = datos,mapping = aes(x = x,y = y)) g
g=g+geom_point(color="red") g
g=g+geom_line(color="blue") g