daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest Jan 21st, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set.seed(95014123)
  2. mydata <- data.frame(matrix(round(runif(100)*1000,0),nrow=50))
  3. names(mydata) <- c("credit card usage","value")
  4. head(mydata)
  5. head(mydata[order(mydata[["credit card usage"]]),])
  6.    
  7. > set.seed(95014123)
  8. > mydata <- data.frame(matrix(round(runif(100)*1000,0),nrow=50))
  9. > names(mydata) <- c("credit card usage","value")
  10. > head(mydata)
  11.   credit card usage value
  12. 1               795   217
  13. 2               816   613
  14. 3               342   323
  15. 4               126   751
  16. 5               618   780
  17. 6               625   529
  18. > head(mydata[order(mydata[["credit card usage"]]),])
  19.    credit card usage value
  20. 47                25   109
  21. 44                81   534
  22. 18                91   985
  23. 31                99   931
  24. 19               109   190
  25. 4                126   751
  26. >
  27.    
  28. # replace spaces with underscores
  29. names(mydata) <- gsub(" ","_",names(mydata))
  30. head(mydata[order(mydata$credit_card_usage),])
  31.    
  32. > # replace spaces with underscores
  33. > names(mydata) <- gsub(" ","_",names(mydata))
  34. > head(mydata[order(mydata$credit_card_usage),])
  35.    credit_card_usage value
  36. 47                25   109
  37. 44                81   534
  38. 18                91   985
  39. 31                99   931
  40. 19               109   190
  41. 4                126   751
  42. >
RAW Paste Data
Top