Draw graph of function in R? [duplicate]


In R, is there a way to draw the graph of a function? For example

h(x) =  x^5 + x^8 + (cos(x))^3 + 0.6e^x

I have tried, but keep receiving syntax errors such as unexpected ^ in h(x)


Answers:


h <- function(x) x^5 + x^8 + cos(x)^3 + .6*exp(x)

plot(1:10, h(1:10))

plot(1:10, h(1:10), pch=19, cex=3, col=rainbow(10, alpha=.5, .5), type='o', lty=2, ylab='', xlab='', main='Plots for da winnnn!')

enter image description here