Guest User

Untitled

a guest
Jun 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. N <- seq(from=100,to=2000,by=1)
  2. P <- choose(N-100, 50) / choose(N, 60)
  3. ## Normalization of Ps:
  4. sum(P)
  5. P <- P / sum(P)
  6. ## Plot it:
  7. plot(N, P, type = "l",las=1)
  8.  
  9. P[which(N) = 386]
  10.  
  11. # Set seed for reproducible example
  12. set.seed(42)
  13.  
  14. # Create a dataframe of random numbers
  15. mydf <- data.frame(X=rnorm(45),Y=rnorm(45))
  16.  
  17. # For example set the value of 5th element to 386 as in your question
  18. mydf$X[5] <- 386
  19.  
  20. # Print the fifth value of Y
  21. print(mydf$Y[5])
  22.  
  23. # Use to find X where it is value and print equivalent value of Y
  24. print(mydf$Y[which(mydf$X==386)])
  25.  
  26. P[which(N == 386)]
Add Comment
Please, Sign In to add comment