warabandi

Warabandi or Roster of Turn

Introduction: This function will generate roster for a week (168 hrs. or 24X7). Flow time of a watercourse to an individual farmer calculate based on their holding area (bigga or hectares), This flow time roster generated by this function known as “warabandi” in canal irrigated agricultural areas (Punjab, Rajasthan, Haryana and Some areas of Pakistan)

Load Package

library(warabandi)

data structure of input data

head(warabandi_data)
##       Name_of_Farmer Nkka.No.   x1 MuNo   x2 MuNo.1   x3 MuNo.2   x4 MuNo.3  x5
## 1        Kahan Singh        5  4.5    5  2.0      1  5.0     13 12.5     23  NA
## 2 Harvinderpal Singh        5  4.5    5 24.5     14 12.0     57   NA         NA
## 3      Jasvant Singh        5  5.3    5  9.7     26  8.5     55   NA         NA
## 4     Mukhtyar Singh        5  7.8    5 11.5      6  9.8     10 24.5     27 9.8
## 5              Diggi       NA   NA        NA          NA          NA         NA
## 6       Pooran Singh        6 11.5    6   NA          NA          NA         NA
##   MuNo.4 x6 MuNo.5  x7 MuNo.6 Bharai Katai
## 1     NA NA     NA  NA          0:00  0:00
## 2     NA NA     NA  NA          0:00  0:00
## 3     NA NA     NA  NA          0:00  0:04
## 4     26 10     55 0.5     44   0:00  0:00
## 5     NA NA     NA  NA          0:12  0:00
## 6     NA NA     NA  NA          0:15  0:00

#Calulation of roster Here we are not writing output to reduce vignettes and space

output<-warabandi(file = warabandi_data, output = FALSE, nof = "my_file.csv")
##                               Name Nakka
## 1                      Kahan Singh     5
## 2               Harvinderpal Singh     5
## 3                    Jasvant Singh     5
## 4                   Mukhtyar Singh     5
## 5                            Diggi    NA
## 6                     Pooran Singh     6
## 7                     Nirmal Singh     9
## 8                     Jagtar Singh     4
## 9     Harbhinder singh/Rulda Singh     3
## 10                  Chamkaur Singh     3
## 11                    Preetam Sing    11
## 12                    Ikbaal Singh    22
## 13                           Diggi    NA
## 14                  Gurpreet Singh    23
## 15                  Chamkaur Singh    12
## 16                           Diggi    NA
## 17                           Diggi    NA
## 18                    Jagtar Singh    12
## 19                    Jagtar Singh    12
## 20                    Jagtar Singh    21
## 21                  Chamkaur Singh    21
## 22                 Hargovind Singh    21
## 23                 Hargovind Singh    21
## 24                           Diggi    NA
## 25                 Hargovind Singh    24
## 26                      Mewa Singh    33
## 27                     Kapal Singh    33
## 28                 Gurbachan Singh    33
## 29                 Harbhajan Singh    13
## 30                  Surendra Singh    19
## 31              Harvinderpal Singh    26
## 32                           Diggi    NA
## 33                  Hoshiyar Singh    32
## 34                 Kulvinder Singh    31
## 35                  Shri Gurudwara    31
## 36                  Saudagar Singh    31
## 37                  Saudagar Singh    34
## 38                  Sukhwant Singh    35
## 39                 Harbhajan Singh    40
## 40                 Baljinder Singh    42
## 41                 Baljinder Singh    43
## 42                    Ikbaal Singh    52
## 43                    Abaadi Diggi    39
## 44                  Hoshiyar Singh    44
## 45                  Mukhtyar Singh    44
## 46                       budhraam     51
## 47                      Bant Singh    51
## 48            Tej Singh, Gej Singh    55
## 49                    Ikbaal Singh    56
## 50                  Saudagar Singh    48
## 51                   Preetam Singh    48
## 52                         Unknown    NA
## 53                     Rulda Singh    57
## 54 Harbhinderpal Singh/Rulda Singh    47
## 55                     Rulda Singh    15
## 56                     Rulda Singh    18
## 57                   Gurjeet Singh    16
## 58                    Jagdev Singh    17
## 59                           Abadi    NA
##                                                                     Drkva
## 1                  4.5, 2, 5, 12.5, 0, 0, 0 \n MNo 5, 1, 13, 23,  0,  0, 
## 2                  4.5, 24.5, 12, 0, 0, 0, 0 \n MNo 5, 14, 57, ,  0,  0, 
## 3                  5.3, 9.7, 8.5, 0, 0, 0, 0 \n MNo 5, 26, 55, ,  0,  0, 
## 4      7.8, 11.5, 9.8, 24.5, 9.8, 10, 0.5 \n MNo 5, 6, 10, 27, 26, 55, 44
## 5                             0, 0, 0, 0, 0, 0, 0 \n MNo , , , ,  0,  0, 
## 6                         11.5, 0, 0, 0, 0, 0, 0 \n MNo 6, , , ,  0,  0, 
## 7          25, 4.8, 24.5, 7.35, 6, 2.95, 0 \n MNo 9, 10, 28, 29, 47, 16, 
## 8                        3.5, 0, 0, 0, 0, 0, 0 \n MNo 3TW, , , ,  0,  0, 
## 9                       1.05, 0, 0, 0, 0, 0, 0 \n MNo 3TW, , , ,  0,  0, 
## 10                       3.5, 0, 0, 0, 0, 0, 0 \n MNo 3TW, , , ,  0,  0, 
## 11                25, 12, 7, 0.6, 0, 0, 0 \n MNo 11, 4, 56, 4TW,  0,  0, 
## 12                      24, 20, 0, 0, 0, 0, 0 \n MNo 22, 52, , ,  0,  0, 
## 13                            0, 0, 0, 0, 0, 0, 0 \n MNo , , , ,  0,  0, 
## 14      12.5, 10, 14.25, 10.35, 1, 1.6, 0 \n MNo 23, 10, 20, 53, 31, 35, 
## 15                10.5, 2.9, 1.1, 0, 0, 0, 0 \n MNo 12, 3, 21, ,  0,  0, 
## 16                            0, 0, 0, 0, 0, 0, 0 \n MNo , , , ,  0,  0, 
## 17                            0, 0, 0, 0, 0, 0, 0 \n MNo , , , ,  0,  0, 
## 18                     9.6, 5.3, 0, 0, 0, 0, 0 \n MNo 12, 4, , ,  0,  0, 
## 19                    15.6, 0, 0, 0, 0, 0, 0 \n MNo 12BAG, , , ,  0,  0, 
## 20                    15.6, 0, 0, 0, 0, 0, 0 \n MNo 21BAG, , , ,  0,  0, 
## 21                    30.4, 0, 0, 0, 0, 0, 0 \n MNo 21BAG, , , ,  0,  0, 
## 22                    30.4, 0, 0, 0, 0, 0, 0 \n MNo 21BAG, , , ,  0,  0, 
## 23                   3.2, 2, 0.5, 0, 0, 0, 0 \n MNo 21, 3, 30, ,  0,  0, 
## 24                            0, 0, 0, 0, 0, 0, 0 \n MNo , , , ,  0,  0, 
## 25                       19.6, 0, 0, 0, 0, 0, 0 \n MNo 24, , , ,  0,  0, 
## 26                      5, 4.9, 0, 0, 0, 0, 0 \n MNo 33, 24, , ,  0,  0, 
## 27                         10, 0, 0, 0, 0, 0, 0 \n MNo 33, , , ,  0,  0, 
## 28                         10, 0, 0, 0, 0, 0, 0 \n MNo 33, , , ,  0,  0, 
## 29              20, 12.5, 16.15, 0, 0, 0, 0 \n MNo 13, 25, 30, ,  0,  0, 
## 30              24, 11.3, 12, 15, 0, 0, 0 \n MNo 19, 40, 56, 54,  0,  0, 
## 31                          5, 0, 0, 0, 0, 0, 0 \n MNo 26, , , ,  0,  0, 
## 32                            0, 0, 0, 0, 0, 0, 0 \n MNo , , , ,  0,  0, 
## 33     25, 12.5, 5, 4.4, 7.2, 6.55, 0.5 \n MNo 32, 25, 48, 35, 40, 43, 44
## 34  13.7, 0.6, 7.85, 14.9, 0.25, 0, 8.4 \n MNo 31, 35, 30, 42, 43,  0, 53
## 35                        4.8, 0, 0, 0, 0, 0, 0 \n MNo 31, , , ,  0,  0, 
## 36            9.8, 6, 1.6, 10.25, 0, 0, 0 \n MNo 31, 41, 35, 20,  0,  0, 
## 37               17, 6.25, 10, 6, 0, 0, 0 \n MNo 34, 53, 54, 47,  0,  0, 
## 38                 15.6, 9.8, 2, 0, 0, 0, 0 \n MNo 35, 43, 51, ,  0,  0, 
## 39                          5, 0, 0, 0, 0, 0, 0 \n MNo 40, , , ,  0,  0, 
## 40                    5.1, 6.5, 0, 0, 0, 0, 0 \n MNo 42, 41, , ,  0,  0, 
## 41                    8.1, 7.5, 0, 0, 0, 0, 0 \n MNo 43, 34, , ,  0,  0, 
## 42                          5, 0, 0, 0, 0, 0, 0 \n MNo 52, , , ,  0,  0, 
## 43                            0, 0, 0, 0, 0, 0, 0 \n MNo , , , ,  0,  0, 
## 44                        4.5, 0, 0, 0, 0, 0, 0 \n MNo 44, , , ,  0,  0, 
## 45                        4.5, 0, 0, 0, 0, 0, 0 \n MNo 44, , , ,  0,  0, 
## 46                   2.9, 0.35, 0, 0, 0, 0, 0 \n MNo 51, 44, , ,  0,  0, 
## 47                   6.7, 5.75, 0, 0, 0, 0, 0 \n MNo 51, 49, , ,  0,  0, 
## 48                          6, 0, 0, 0, 0, 0, 0 \n MNo 55, , , ,  0,  0, 
## 49                          5, 0, 0, 0, 0, 0, 0 \n MNo 56, , , ,  0,  0, 
## 50                       19.5, 0, 0, 0, 0, 0, 0 \n MNo 48, , , ,  0,  0, 
## 51           5, 2.4, 0.8, 2.4, 0.85, 0, 0 \n MNo 48, 51, 44, 51, 44,  0, 
## 52                            0, 0, 0, 0, 0, 0, 0 \n MNo , , , ,  0,  0, 
## 53                         13, 0, 0, 0, 0, 0, 0 \n MNo 57, , , ,  0,  0, 
## 54                         19, 0, 0, 0, 0, 0, 0 \n MNo 47, , , ,  0,  0, 
## 55                   14.5, 7, 0, 0, 0, 0, 0 \n MNo 15, 15TW, , ,  0,  0, 
## 56 24, 1.1, 17.15, 10, 7.25, 1.05, 2.9 \n MNo 18, 16, 29, 2,  3, 16, 16TW
## 57              1.5, 2.8, 7.5, 0, 0, 0, 0 \n MNo 16, 51, 16TW, ,  0,  0, 
## 58              24.5, 6, 12.5, 7, 5, 0, 0 \n MNo 17, 16, 41, 50, 50,  0, 
## 59                            0, 0, 0, 0, 0, 0, 0 \n MNo , , , ,  0,  0, 
##    RakvaSum TotalTurn Bharai Jharai                     Time_schedule
## 1     24.00      3:13   0:00   0:00        Monday, 18:0-Monday, 21:13
## 2     41.00      5:31   0:00   0:00       Monday, 21:13-Tuesday, 2:44
## 3     23.50       3:5   0:00   0:04       Tuesday, 2:44-Tuesday, 5:50
## 4     73.90      9:56   0:00   0:00      Tuesday, 5:50-Tuesday, 15:47
## 5      0.00      0:12   0:12   0:00     Tuesday, 15:47-Tuesday, 15:59
## 6     11.50      1:47   0:15   0:00     Tuesday, 15:59-Tuesday, 17:47
## 7     70.60      9:30   0:10   0:10    Tuesday, 17:47-Wednesday, 3:17
## 8      3.50      0:28   0:00   0:00   Wednesday, 3:17-Wednesday, 3:45
## 9      1.05      0:23   0:15   0:00    Wednesday, 3:45-Wednesday, 4:9
## 10     3.50      0:28   0:00   0:00    Wednesday, 4:9-Wednesday, 4:37
## 11    44.60      6:15   0:15   0:00  Wednesday, 4:37-Wednesday, 10:52
## 12    44.00      6:10   0:15   0:00  Wednesday, 10:52-Wednesday, 17:2
## 13     0.00      0:12   0:12   0:00  Wednesday, 17:2-Wednesday, 17:14
## 14    49.70      6:41   0:15   0:15 Wednesday, 17:14-Wednesday, 23:56
## 15    14.50      2:21   0:24   0:00   Wednesday, 23:56-Thursday, 2:17
## 16     0.00       0:4   0:04   0:00     Thursday, 2:17-Thursday, 2:21
## 17     0.00       0:4   0:04   0:00     Thursday, 2:21-Thursday, 2:25
## 18    14.90       2:0   0:00   0:00     Thursday, 2:25-Thursday, 4:25
## 19    15.60       2:5   0:00   0:00     Thursday, 4:25-Thursday, 6:31
## 20    15.60      2:20   0:15   0:00     Thursday, 6:31-Thursday, 8:52
## 21    30.40       4:5   0:00   0:00    Thursday, 8:52-Thursday, 12:57
## 22    30.40       4:5   0:00   0:00    Thursday, 12:57-Thursday, 17:3
## 23     5.70      0:46   0:00   0:00    Thursday, 17:3-Thursday, 17:49
## 24     0.00       0:5   0:05   0:00   Thursday, 17:49-Thursday, 17:54
## 25    19.60      2:53   0:15   0:00   Thursday, 17:54-Thursday, 20:47
## 26     9.90      1:34   0:15   0:00   Thursday, 20:47-Thursday, 22:22
## 27    10.00      1:20   0:00   0:00   Thursday, 22:22-Thursday, 23:43
## 28    10.00       1:2   0:00   0:18      Thursday, 23:43-Friday, 0:46
## 29    48.65      6:44   0:12   0:00         Friday, 0:46-Friday, 7:31
## 30    62.30      8:33   0:10   0:00         Friday, 7:31-Friday, 16:4
## 31     5.00      0:50   0:10   0:00        Friday, 16:4-Friday, 16:54
## 32     0.00      0:12   0:12   0:00        Friday, 16:54-Friday, 17:6
## 33    61.15      8:23   0:10   0:00       Friday, 17:6-Saturday, 1:30
## 34    45.70       6:9   0:00   0:00     Saturday, 1:30-Saturday, 7:39
## 35     4.80      0:38   0:00   0:00     Saturday, 7:39-Saturday, 8:18
## 36    27.65      3:43   0:00   0:00     Saturday, 8:18-Saturday, 12:1
## 37    39.25      5:26   0:10   0:00    Saturday, 12:1-Saturday, 17:28
## 38    27.40      3:41   0:00   0:00    Saturday, 17:28-Saturday, 21:9
## 39     5.00      0:50   0:10   0:00    Saturday, 21:9-Saturday, 21:59
## 40    11.60      1:43   0:10   0:00   Saturday, 21:59-Saturday, 23:43
## 41    15.60       2:5   0:00   0:00      Saturday, 23:43-Sunday, 1:49
## 42     5.00      0:45   0:15   0:10         Sunday, 1:49-Sunday, 2:34
## 43     0.00      2:40   2:40   0:00         Sunday, 2:34-Sunday, 5:14
## 44     4.50      0:51   0:15   0:00          Sunday, 5:14-Sunday, 6:6
## 45     4.50      0:36   0:00   0:00          Sunday, 6:6-Sunday, 6:42
## 46     3.25      0:51   0:25   0:00         Sunday, 6:42-Sunday, 7:33
## 47    12.45      1:40   0:00   0:00         Sunday, 7:33-Sunday, 9:14
## 48     6.00       1:7   0:19   0:00        Sunday, 9:14-Sunday, 10:21
## 49     5.00      0:50   0:10   0:00       Sunday, 10:21-Sunday, 11:12
## 50    19.50      2:37   0:00   0:00       Sunday, 11:12-Sunday, 13:49
## 51    11.45      1:32   0:00   0:00       Sunday, 13:49-Sunday, 15:22
## 52     0.00       0:0   0:00   0:00       Sunday, 15:22-Sunday, 15:22
## 53    13.00      0:53   0:10   1:01       Sunday, 15:22-Sunday, 16:16
## 54    19.00      2:33   0:00   0:00       Sunday, 16:16-Sunday, 18:49
## 55    21.50       3:8   0:15   0:00       Sunday, 18:49-Sunday, 21:58
## 56    63.45      8:48   0:16   0:00        Sunday, 21:58-Monday, 6:46
## 57    11.80      1:35   0:00   0:00         Monday, 6:46-Monday, 8:21
## 58    55.00      7:28   0:04   0:00        Monday, 8:21-Monday, 15:50
## 59     0.00      2:10   2:55   0:45        Monday, 15:50-Monday, 18:0

#Lets take a look at output Output generated by package is a list of different objects. 1. Flow time per unit area in minutes 2. Rakva or total area under command subject to be irrigated 3. Bharai or fillig time; as a compensation 4. Jharai or empty time 5. Weekdays or total duration has to be divided 6. Final table calculated by warabandi saved as a output file to the working directory

output[1:5]
## [[1]]
## [1] 8
## 
## [[2]]
## [1] 1176.95
## 
## [[3]]
## [1] "12H 19M 0S"
## 
## [[4]]
## [1] "2H 43M 0S"
## 
## [[5]]
## [1] "7d 0H 0M 0S"
Report_Table<-data.frame(output[6])
head(Report_Table)
##                 Name Nakka
## 1        Kahan Singh     5
## 2 Harvinderpal Singh     5
## 3      Jasvant Singh     5
## 4     Mukhtyar Singh     5
## 5              Diggi    NA
## 6       Pooran Singh     6
##                                                                Drkva RakvaSum
## 1             4.5, 2, 5, 12.5, 0, 0, 0 \n MNo 5, 1, 13, 23,  0,  0,      24.0
## 2             4.5, 24.5, 12, 0, 0, 0, 0 \n MNo 5, 14, 57, ,  0,  0,      41.0
## 3             5.3, 9.7, 8.5, 0, 0, 0, 0 \n MNo 5, 26, 55, ,  0,  0,      23.5
## 4 7.8, 11.5, 9.8, 24.5, 9.8, 10, 0.5 \n MNo 5, 6, 10, 27, 26, 55, 44     73.9
## 5                        0, 0, 0, 0, 0, 0, 0 \n MNo , , , ,  0,  0,       0.0
## 6                    11.5, 0, 0, 0, 0, 0, 0 \n MNo 6, , , ,  0,  0,      11.5
##   TotalTurn Bharai Jharai                 Time_schedule
## 1      3:13   0:00   0:00    Monday, 18:0-Monday, 21:13
## 2      5:31   0:00   0:00   Monday, 21:13-Tuesday, 2:44
## 3       3:5   0:00   0:04   Tuesday, 2:44-Tuesday, 5:50
## 4      9:56   0:00   0:00  Tuesday, 5:50-Tuesday, 15:47
## 5      0:12   0:12   0:00 Tuesday, 15:47-Tuesday, 15:59
## 6      1:47   0:15   0:00 Tuesday, 15:59-Tuesday, 17:47

Report generation of warabandi

Generation of the report in printable format which can be supplied or distribut- ed among all the farmers. This step is highle depend on the external packages (knitr, flextable). Code chunk provide below is a sample which can be modified as per user need like header and fotters. Lets read output file generated by warabandi package

data2<-Report_Table

Lets make table

flextable::flextable(head(data2))

Name

Nakka

Drkva

RakvaSum

TotalTurn

Bharai

Jharai

Time_schedule

Kahan Singh

5

4.5, 2, 5, 12.5, 0, 0, 0
MNo 5, 1, 13, 23, 0, 0,

24.0

3:13

0:00

0:00

Monday, 18:0-Monday, 21:13

Harvinderpal Singh

5

4.5, 24.5, 12, 0, 0, 0, 0
MNo 5, 14, 57, , 0, 0,

41.0

5:31

0:00

0:00

Monday, 21:13-Tuesday, 2:44

Jasvant Singh

5

5.3, 9.7, 8.5, 0, 0, 0, 0
MNo 5, 26, 55, , 0, 0,

23.5

3:5

0:00

0:04

Tuesday, 2:44-Tuesday, 5:50

Mukhtyar Singh

5

7.8, 11.5, 9.8, 24.5, 9.8, 10, 0.5
MNo 5, 6, 10, 27, 26, 55, 44

73.9

9:56

0:00

0:00

Tuesday, 5:50-Tuesday, 15:47

Diggi

0, 0, 0, 0, 0, 0, 0
MNo , , , , 0, 0,

0.0

0:12

0:12

0:00

Tuesday, 15:47-Tuesday, 15:59

Pooran Singh

6

11.5, 0, 0, 0, 0, 0, 0
MNo 6, , , , 0, 0,

11.5

1:47

0:15

0:00

Tuesday, 15:59-Tuesday, 17:47

Lets generate report for individual farmer

data3 <- data.frame(head(data2))
invisible(by(data3, seq_len(nrow((data3))), function(row) {
  chak<-"Chak-38 R.B" 
distributries<- "R.B II"
dateOI<-date()
dateOd<-"Date of distribution __/__/____"
note1<-"Note: All schedules issued before this, are cancelled"
Year_o_Valid<-"Year: April 2019 to 2025"
Issue<-"Issue Serial No:________/___"
Jal_upbhokta<-"Jal Upbhokta Sangam:"
d5 <-flextable::fit_to_width(flextable::flextable(row), max_width = 7,
                             inc=1L, max_iter = 20)
d5 <- flextable::add_header_lines(d5, c(paste(Year_o_Valid,"\t","\t", chak), paste(Jal_upbhokta,
                                                                                   distributries, "\t","\t", Issue, "\t","\t","\t","\t",  dateOI)))
d5 <-flextable::add_footer_lines(d5, 
                                 c(paste(dateOd, "\t", "\t", note1), 
                                   paste("President", "\n", "\n", "\n", 
                                         Jal_upbhokta, distributries)))
 #flextable::flextable_to_rmd(d5)

 }))

Lets take a look at report for individual farmer

Contact us

That’s all! Thanks for being here. Let me know if you heve any doubt about this package or issue Harvinder Singh Department of pharmacology PGIMER, Chandigarh (160012) ORCID https://orcid.org/0000-0002-6349-3143