```r
dfdf<-data.frame(a= c(80,90,100,110,120),
b= c(500,400,300,200,100))
index= 102

```

How to find the closest value to 102 in column a and return the value of the same row in column b?

expected output:
300

```r
#attempt 1
index2<-min(abs(dfdf$a- index))
dfdf$b[dfdf$a- index==index2] # error sometimes positive values ​​and other times the value is negative

##output:
>numeric(0)

```