Question: I have a column in my data frame `df` called `Ratio` which comprises of two positive integers `x` and `y` separated by a `/` [That is, format the is `x/y`]. I would like to replace each row in this column by `integer((x/y)*10)` (rounded off to the nearest integer)

Example, if that value of an element in `Ratio` is `14/20` I need to change it to `7`.

[There is a level `0/0` in the `Ratio` column in which case I would like it changed to `5`]

Answer: 
Here's an approach:

```
# an example data frame
> dat <- data.frame(Ratio = c("0/0", "14/20"))

transform(dat, Ratio2 = sapply(strsplit(as.character(Ratio), "/"), function(x) 
  if (x[2] == "0") 5 else round(Reduce("/", as.integer(x)) * 10)))
#   Ratio Ratio2
# 1   0/0      5
# 2 14/20      7

```
Have you tried to use `as.integer`?

```
> as.integer(14.001/20.01*10)
[1] 7

```