Hi, im trying to filter this data by the various words
The words that im triying to get from the data from the column "Nombre.producto.genrico" with the grepl funcion using the words "BIC , INFUSION , VOLUMETRICA , BOMBA "
Im trying not to brute force every other result with grepl, is there another way? another function that i can use?
The main problem that i have its that the grepl gets words like "BICICLETA" because i search for BIC, but BIC also stands for "Bomba Infusion Continua" and i dont know how to filter it
The code im using its the following
setwd("D:/OWMED/Database/Licitaciones/2020")
library(tidyverse)
#> Warning: package 'tidyverse' was built under R version 4.1.3
library(reprex)
#> Warning: package 'reprex' was built under R version 4.1.3
Licita_1 <- read.csv2("lic_2020-1.csv")
Licita_2 <- read.csv2("lic_2020-2.csv")
Licita_3 <- read.csv2("lic_2020-3.csv")
Licita_2019 <- bind_rows( Licita_1 ,
Licita_2 ,
Licita_3 ,
)
Licita_data = Licita_2019 %>% select ("CodigoExterno"
, "NombreProveedor"
, "Nombre.producto.genrico"
, "Oferta.seleccionada"
, "NombreOrganismo"
, "CantidadAdjudicada"
, "sector"
, "TiempoDuracionContrato")
Licita_data <- filter(Licita_data, grepl('BOMBA|INFUSION|BIC|VOLUMETRICA|DOSIFICADORES', Nombre.producto.genrico))
str(Licita_data,3)
#> 'data.frame': 2073 obs. of 8 variables:
#> $ CodigoExterno : chr "2585-149-LE19" "2585-149-LE19" "1058039-1-LQ19" "1058039-1-LQ19" ...
#> $ NombreProveedor : chr "AGROMAIPO" "OSM Ltda." "Caribean Pharma Ltda" "LABORATORIOS RECALCINE S.A" ...
#> $ Nombre.producto.genrico: chr "VACUNA ANTIRRÁBICA" "VACUNA ANTIRRÁBICA" "ÁCIDO ASCÓRBICO" "ÁCIDO ASCÓRBICO" ...
#> $ Oferta.seleccionada : chr "No Seleccionada" "No Seleccionada" "No Seleccionada" "No Seleccionada" ...
#> $ NombreOrganismo : chr "I MUNICIPALIDAD DE ARICA" "I MUNICIPALIDAD DE ARICA" "SERVICIO DE SALUD CONCEPCION ARAUCO CONS" "SERVICIO DE SALUD CONCEPCION ARAUCO CONS" ...
#> $ CantidadAdjudicada : num 0 0 0 0 0 1 0 0 0 1 ...
#> $ sector : chr "Municipalidades" "Municipalidades" "Salud" "Salud" ...
#> $ TiempoDuracionContrato : int 0 0 24 24 24 24 24 24 24 24 ...
Created on 2022-03-31 by the reprex package (v2.0.1)