Question: I have a data frame that looks like this:

```
a <- c(1.2,1.19,1.1,1.09,1.09)
b <- c(1.2, 1.18,1.12,1.11, 1.09)
d<- data.frame(a,b)
rownames(d) <- c('450','500','899','1004','1112')

        a    b
450  1.20 1.20
500  1.19 1.18
899  1.10 1.12
1004 1.09 1.11
1112 1.09 1.09

```

I want to write a short function or one-liner that will return the row name of the row where all values in that row (in this case the values of `a` and `b`) are *all* less than the value `1.1`. This condition is only satisfied in the final row of this data frame, with row name `1112`. Note, the solution must generalize, such that it can operate on potentially many more columns, and data frames with many more rows.

Answer: 
This is a general, vectorized way to obtain the desired result:

```
rownames(d[rowSums(d < 1.1) == ncol(d),])
#[1] "1112"

```
This function using `apply` should work:

```
rownames(d)[apply(d, 1, function(x) all(x < 1.1))]

```

Here, the rownames are subset using a logical vector. `apply` loops through each row and uses `all` to check if all entries are less than 1.1.

You could wrap this in a function as follows:

```
row.checker <- function(df, value) {
  rownames(df)[apply(df, 1, function(x) all(x < value))]
}

```