Df <- data.frame(A = c(2, 10, 20, 40),
B = c(8,12,25,45))
I want to populate a vector with all values between row 1:column A and row 1:column B, as well as row 2:column A and row2:column B, and so on, for all rows of a dataframe.
So, I want to populate a vector with 2,3,4,5,6,7,8,10,11,12,20,21,22,23,24,25,40,41,42,43,44,45 in this example dataframe, such that I can then see if these values are present elsewhere.
I have tried integer in between options and indexing with for loops, but struggling. Would really appreciate any help. Many thanks.