Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. abc <- function(x,n)
  2. {
  3. vector <- c()
  4.  
  5. max <- max(x)
  6. min <- min(x)
  7. p <- seq(from=min(x), to=max(x), length.out = n+1)
  8.  
  9.  
  10. for (i in x) {
  11. #print(i)
  12. for (j in 2:length(p)) {
  13. if(p[(j-1)] <= i && i <= p[j]){
  14. #print(sprintf("<%f,%f>", p[j-1], p[j]))
  15. vector <- c(vector, sprintf("(%f,%f)", p[j-1], p[j]))
  16. }
  17. }
  18. }
  19.  
  20. return(vector)
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement