Use of merge and _join in R

0

I'm trying to make a type searchV in R between two data frames,

This DF Comprador is the one that will take the reference (138 ROWS) (Buyer is what I need)

This DF li is the one I want to complete (520 ROWS) with BUYER according to the LINE

I simply want to assign the corresponding buyer ACCORDING TO THE LINE

I've tried it with right_Join and merge but I increase the rows

Can someone help me?

  Comprador <- read_excel("/home/po11/Desktop/Comprador.xlsx")
  pen_surtir1 <- read_excel("/home/po11/Desktop/pen_surtir1.xlsx") 

  ALM <- c("A1", "C1", "F1", "E1")

  b <- data.frame(ALM, stringsAsFactors = FALSE) 

  tabla_filtrada_alm <- left_join(b, pen_surtir1)

  datas <- select(tabla_filtrada_alm, ALM,ORDEN,PEDIDO, ENTREGA, CLAVE, 
   ORDENADA, SURTIDA, PEND.) 

  datasf <- transform(datas, PEDIDO = as.POSIXct(PEDIDO, format = "%Y%m%d"), 
                         ENTREGA = as.POSIXct(ENTREGA, format = "%Y%m%d"))

  FREPORTE <- c(Sys.Date())
  datasfin <- cbind(datasf, FREPORTE)

   compr <- select(tabla_filtrada_alm, CLAVE)

   tablapr <- mutate(datasf, LINEA = substr(CLAVE, 1,2)) #

   li <- select(tablapr, LINEA)    

   ss <- merge(li, Comprador)
    
asked by Pedro R. Orozco 05.01.2019 в 00:45
source

0 answers