Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. myfun <- function (x) {
  2. UseMethod("myfun")
  3. }
  4.  
  5. myfun.numeric <- function(x) {
  6. a<-x+5
  7. b<-a^2
  8. c<-b+4
  9. d<-c-3
  10. d
  11. }
  12.  
  13. myfun.character <- function(x) {
  14. a<-as.numeric(x)+9
  15. b<-a^2
  16. c<-b+4
  17. d<-c-3
  18. d
  19. }
  20.  
  21. myfun("3")
  22. myfun(3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement