Guest User

Untitled

a guest
Jun 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. library(dplyr)
  2.  
  3. numbers <- c(9, 23, 33, 91, 13)
  4. players <- c("Ron Harper", "Michael Jordan", "Scottie Pippen", "Dennis Rodman", "Luc Longley")
  5. birth_dates <- c("January 20, 1964", "February 17, 1963", "September 25, 1965", "May 13, 1961", "January 19, 1969")
  6. df <- data.frame(number = numbers,
  7. player = players,
  8. birth_date = birth_dates,
  9. stringsAsFactors = FALSE) # 避免處理 factor 型別
  10. df$birth_date <- as.Date(df$birth_date, format = "%B %d, %Y")
  11. df %>%
  12. arrange(birth_date) %>%
  13. View()
Add Comment
Please, Sign In to add comment