Mans.hu

Of life and all its colors

About everything that amazes and confounds me.

About / Blog / Contact
  • 
  • 
  • 
  • 

Categories

  • Amazing
  • Books
  • Business and Technology
  • Chess
  • History
  • Mahabharata
  • Parenting

Search

How to create a normal curve in R?

April 17, 2019 by manshu Leave a Comment

It is surprisingly easy to create a normal curve in R. I was curious to see how many moves my games last for, and the distribution around it. I used the data frame I have created for classical games, and this is the code you need to create the curve:

normal_curve <- ggplot(tal, aes(x = NMoves))+
+ stat_function (fun = dnorm, color = “red”, args = list(mean = mean(tal$NMoves), sd = sd(tal$NMoves)))

You have to specify the variable name for which the curve has to be created, and then specify it again to calculate the mean and the standard deviation as shown above. Running this code will create a normal curve for you as shown below.

R - Normal Curve

Filed Under: Business and Technology

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *