1

tengo las siguientes bases de datos y al tratar de hacer un left_join, me arroja el siguiente error después de compilar el siguiente código:

BASE2=NULL
BASE2$ID1=c(1,2,3,4,5,6,7)
BASE2$NAME=c("A","B","C","D","E","F","G")
BASE2=as.data.frame(BASE2)

BASE3=NULL
BASE3$ID2=c(1,2,4,7,8,9,10)
BASE3$NAME=c("A","B","C","D","E","F","G")
BASE3=as.data.frame(BASE3)


BASE1=dplyr::left_join(BASE2,BASE3,c("ID1","ID2"))

Error in `dplyr::left_join()`:
! Join columns in `x` must be present in the data.
✖ Problem with `ID2`.

1 respuesta 1

2

Ya encontre el error

BASE2=NULL
BASE2$ID1=c(1,2,3,4,5,6,7)
BASE2$NAME=c("A","B","C","D","E","F","G")
BASE2=as.data.frame(BASE2)

BASE3=NULL
BASE3$ID2=c(1,2,4,7,8,9,10)
BASE3$NAME=c("A","B","C","D","E","F","G")
BASE3=as.data.frame(BASE3)


BASE1=dplyr::left_join(BASE2,BASE3,by=c("ID1" = "ID2"))

Se debe colocar un signo igual (=) y un by.

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.