Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df=structure(list(SKU = c(11202L, 11202L, 11202L, 11202L, 11202L,
- 11202L, 11202L, 11202L, 11202L, 11202L, 11202L, 11202L, 11202L,
- 11202L, 11202L, 11202L, 11202L, 11202L, 11202L, 11202L, 11202L
- ), stuff = c(8.85947691, 9.450108704, 10.0407405, 10.0407405,
- 10.63137229, 11.22200409, 11.22200409, 11.81263588, 12.40326767,
- 12.40326767, 12.40326767, 12.99389947, 13.58453126, 14.17516306,
- 14.76579485, 15.94705844, 17.12832203, 17.71895382, 21.26274458,
- 25.98779894, 63.19760196), action = c(0L, 0L, 0L, 0L, 0L, 0L,
- 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L),
- acnumber = c(137L, 137L, 137L, 137L, 137L, 137L, 137L, 137L,
- 137L, 137L, 137L, 137L, 137L, 137L, 137L, 137L, 137L, 137L,
- 137L, 137L, 137L), year = c(2018L, 2018L, 2018L, 2018L, 2018L,
- 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L,
- 2018L, 2018L, 2018L, 2018L, 2018L, 2018L, 2018L)), .Names = c("SKU",
- "stuff", "action", "acnumber", "year"), class = "data.frame", row.names = c(NA,
- -21L))
- # i take data from sql
- dbHandle <- odbcDriverConnect("driver={SQL Server};server=;database=;trusted_connection=true")
- sql <- paste0(select needed columns)
- df <- sqlQuery(dbHandle, sql)
- for groups where from 1-4 observations by stuff of 1 category of action then C:/path to/скрипт1.r
- (or if groups have from 1-4 observations by stuff of 1 category of action then C:/path to/script1.r)
- for groups where >=5 observations by stuff of 1 category of action then C:/path to/script2.r
- ( 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