I am trying to join two dataframes using user selected two columns from a datatable in a shiny app
I'd like to join them using the column names which I have put into a variable. However when I do the left join I get an error. When I use the character of the name it works fine.
My code
EndoDate<-colnames(RV$data[as.numeric(input$endotable_columns_selected[1])])
EndoNum<-colnames(RV$data[as.numeric(input$endotable_columns_selected[2])])
PathDate<-colnames(RV2$data[as.numeric(input$endotable_columns_selected[1])])
PathNum<-colnames(RV2$data[as.numeric(input$endotable_columns_selected[2])])
This doesn't work:
left_join(RV$data,RV2$data,by = c(EndoDate=PathDate,EndoNum=PathNum))
..But this does work
left_join(RV$data,RV2$data,by = c("endo_resultperformed"="endo_resultperformed","hospitalnumber"="hospitalnumber"))
I need to use the column names chosen by the user. How can I do this and do the join? Is this a symbol dplyr problem?