readProcurementBook: Reads manually coded procurement data for Karnataka and...

Description Usage Arguments Examples

View source: R/readProcurementBook.R

Description

Reads manually coded procurement data for Karnataka and Odisha

Usage

1
readProcurementBook(file = "TenderReport_ODI_2009_2010.xlsx")

Arguments

file

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (file = "TenderReport_ODI_2009_2010.xlsx") 
{
    all.sheets <- excel_sheets(file)
    readSheets <- function(sheet) {
        print(sheet)
        data <- read_excel(file, sheet = sheet, skip = 2)
        header <- read_excel(file, sheet = sheet, skip = 0)[1, 
            2]
        data <- data[, grepl("description|title|value|bids", 
            colnames(data), ignore.case = TRUE)]
        data$label <- header
        return(data)
    }
    all.data <- lapply(all.sheets, readSheets)
    library(data.table)
    all.data <- rbindlist(all.data)
    all.data$Description1 <- tolower(all.data$Description1)
    all.data$Title <- tolower(all.data$Title)
    all.data <- all.data[!is.na(all.data$Description1), ]
    return(all.data)
  }

jon-mellon/procureClassify documentation built on May 19, 2019, 7:26 p.m.