Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tst_df <- data.frame(id = letters[1:5], x = 1:5, y = 6:10)
- tst_df
- m_dist_wrapper <- function(a,b) {
- apply(b,2, function(x) m_dist(a,x))
- }
- m_dist <- function(a,b) {
- # b = c(b1,b2)
- sqrt(sum((a-b)^2))
- }
- tst_df %>% mutate ( abc = m_dist_wrapper(c(1,1), rbind(x,y) ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement