Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. data = read.csv("2013_NBAseason.csv", header = T)
  2.  
  3. Error in read.table(file = file, header = header, sep = sep, quote = quote, :
  4. duplicate 'row.names' are not allowed"
  5.  
  6. data = read.csv("2013_NBAseason.csv", header = T,
  7. colClasses=c(rep(NA,7),"NULL"), row.names=NULL)
  8.  
  9. head(data)
  10. row.names Date Box.Score Away Away_Points Home Home_Points
  11. 1 Tue, Oct 30, 2012 Box Score Washington Wizards 84 Cleveland Cavaliers 94
  12. 2 Tue, Oct 30, 2012 Box Score Dallas Mavericks 99 Los Angeles Lakers 91
  13. 3 Tue, Oct 30, 2012 Box Score Boston Celtics 107 Miami Heat 120
  14. 4 Wed, Oct 31, 2012 Box Score Sacramento Kings 87 Chicago Bulls 93
  15.  
  16. temp = list.files(pattern="*.csv")
  17. data = do.call("rbind", lapply(temp, read.csv, ...
  18.  
  19. #read data without any row names
  20. data <- read.csv("2013_NBAseason.csv")
  21.  
  22. #enter string "home_points" to last column. I am assuming it is column 6.
  23. data[1, 6] <- "Home_Points"
  24.  
  25. #make row 1, your column names
  26. colnames(data) = data[1, ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement