I have a dataframe with 2 columns namely p1 and p2. I need to split the p1 column into a range of values like 10-50, 50-100, 100-150, etc. After splitting the values of p1, the corresponding values of p2 should be printed. The sample input is given below.
df = data.frame(p1 = c(10,20,70,80,150,200),p2 = c(1000, 1111.7, 15522.1, 15729.3,18033.8,19358.2)).
The sample output is attached below.
When I am trying to do for large dataset p2 getting mixed with p1.