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