Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. library(dplyr)
  2. ## My list of names
  3. name_list = list(c("A", "B"), c("C", "D"))
  4.  
  5. ## Some random function to perform calculations
  6. random_function = function(input){
  7. input/10
  8. }
  9.  
  10. ## The reason you see name_list[[1]][1] is because I wish to do this repeatedly for different list of names.
  11. data.frame("A"=c(1,1,2,2,3,4), "B"=c(1,3,5,7,9,11)) %>%
  12. mutate(A2 = random_function(name_list[[1]])[1])
  13.  
  14. data.frame("A"=c(1,1,2,2,3,4), "B"=c(1,3,5,7,9,11)) %>%
  15. mutate(A2 = random_function(A))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement