Question: I want to Partition the input number to use its ciphers.  

For example, I have an input number : 1563  

How can I separate 1, 5, 6 and 3 and use them as separate integers?

```
package todicemal;

public class um {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int k=1563;
        System.out.println(k);
    }

}

```

How can I use the parts of k which form 1563 and use every single cipher as an integer?

Answer: 
Here's a simple and more elegant way of what you're trying to do.

First, simplify your function (if your'e going to be using it in a pipe, it doesn't need to take the entire df as an argument):

```
fun.rb <- function(estimate, baseline){
  (estimate-baseline)/(baseline)*100
}    

```

Now, all you need to do is create the baseline column, and then call your function for each row, passing in the estimate and baseline columns to your function:

```
df <- df %>% 
  group_by(site,group) %>% 
  mutate(baseline = estimate[method=="method0"], rb = fun.rb(estimate, baseline)) 

```
This may not be the most elegant. I'm just a hack. But I think it does what you want.

```
> library(dplyr)
> newdf <- df %>% filter(method=="method0") %>%
+   rename(method0_value = estimate) %>% 
+   select(-method)
> head(newdf)
  site  group method0_value
1    A group1      2.529237
2    B group2      7.863411

```

This data set would contain all your baseline/control values. 
The next bit of code merges it back to your initial dataframe and creates the variable you want. You could then remove the method0\_value if you wanted to. It is a nice check. 

```
> finaldf <- left_join(df,newdf,by=c("site","group")) %>% 
+   mutate(rb= (estimate/method0_value)*100)
> head(finaldf)
  site  group  estimate  method method0_value       rb
1    A group1  8.928171 method1      2.529237 352.9986
2    A group1 11.171023 method1      2.529237 441.6757
3    A group1 10.790150 method1      2.529237 426.6169
4    A group1  8.990635 method1      2.529237 355.4683
5    A group1 14.813661 method1      2.529237 585.6969
6    A group1 14.518803 method1      2.529237 574.0390

```

I know there are ways of doing this that might be more efficient, but I'm still a noob.