Quantcast
Channel: Match value from one dataframe to values from a second dataframe of different length - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by akrun for Match value from one dataframe to values from a second...

We could use a non-equi joinlibrary(data.table)setDT(df_1)[df_2, Symbol := Symbol, on = .(Min < Value, Max > Value)]df_1# Min Max Symbol#1: 1 3 A#2: 4 7 B#3: 9 14 <NA>#4: 25 100 DOr can use...

View Article



Match value from one dataframe to values from a second dataframe of different...

I have two dataframes like sodf_1 <- data.frame(Min = c(1, 4, 9, 25), Max = c(3, 7, 14, 100))df_2 <- data.frame(Value = c(5, 2, 33), Symbol = c("B", "A", "D"))I want to attach df_2$Symbol to df_1...

View Article
Browsing all 2 articles
Browse latest View live




Latest Images