document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #===========================================================================
  2. # project : A Project
  3. #  script : A Script.r
  4. #  author : Vitor Chagas                          last updated : 2012.03.18
  5. #===========================================================================
  6.  
  7. #---------------------------------------------------------------------------
  8. # create & set work directory root
  9. #---------------------------------------------------------------------------
  10.  
  11. # change as needed
  12. workdir <- \'.\'
  13.  
  14. dir.create(workdir, recursive=TRUE)
  15. setwd(workdir)
  16. rm(workdir)
  17.  
  18. #---------------------------------------------------------------------------
  19. # create folder tree (needed folders)
  20. #---------------------------------------------------------------------------
  21.  
  22. dir.create(\'data\')
  23. dir.create(\'doc\')
  24. dir.create(\'graphs\')
  25. dir.create(\'lib\')
  26. dir.create(\'reports\')
  27.  
  28. #---------------------------------------------------------------------------
  29. # install & load necessary packages
  30. #---------------------------------------------------------------------------
  31.  
  32. necessary = c(\'XLConnect\')
  33.  
  34. installed = necessary %in% .packages(all.available = TRUE)
  35.  
  36. # install
  37. if (length(necessary[!installed]) >=1)
  38.   install.packages(necessary[!installed])
  39.  
  40. # load
  41. for(pkg in necessary)
  42.   library(pkg, character.only=TRUE)  
  43.  
  44. rm(necessary, installed, pkg)
  45.  
  46. #---------------------------------------------------------------------------
  47. # script start
  48. #---------------------------------------------------------------------------
');