Guest User

Untitled

a guest
Jun 24th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. df=structure(list(SKU = c(11202L, 11202L, 11202L, 11202L, 11202L,
  2. 11202L, 11202L, 11202L, 11202L, 11202L, 11202L, 11202L, 11202L,
  3. 11202L, 11202L, 11202L, 11202L, 11202L, 11202L, 11202L, 11202L
  4. ), stuff = c(8.85947691, 9.450108704, 10.0407405, 10.0407405,
  5. 10.63137229, 11.22200409, 11.22200409, 11.81263588, 12.40326767,
  6. 12.40326767, 12.40326767, 12.99389947, 13.58453126, 14.17516306,
  7. 14.76579485, 15.94705844, 17.12832203, 17.71895382, 21.26274458,
  8. 25.98779894, 63.19760196), action = c(0L, 0L, 0L, 0L, 0L, 0L,
  9. 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L),
  10. acnumber = c(137L, 137L, 137L, 137L, 137L, 137L, 137L, 137L,
  11. 137L, 137L, 137L, 137L, 137L, 137L, 137L, 137L, 137L, 137L,
  12. 137L, 137L, 137L), year = c(2018L, 2018L, 2018L, 2018L, 2018L,
  13. 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
  14. 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L)), .Names = c("SKU",
  15. "stuff", "action", "acnumber", "year"), class = "data.frame", row.names = c(NA,
  16. -21L))
  17.  
  18. # i take data from sql
  19. dbHandle <- odbcDriverConnect("driver={SQL Server};server=;database=;trusted_connection=true")
  20. sql <- paste0(select needed columns)
  21. df <- sqlQuery(dbHandle, sql)
  22.  
  23.  
  24.  
  25. for groups where from 1-4 observations by stuff of 1 category of action then C:/path to/скрипт1.r
  26. (or if groups have from 1-4 observations by stuff of 1 category of action then C:/path to/script1.r)
  27. for groups where >=5 observations by stuff of 1 category of action then C:/path to/script2.r
  28. ( of if groups have >=5 observations by stuff of 1 category of action then C:/path to/script2.r)
Add Comment
Please, Sign In to add comment