Succinct way to summarize different columns with different functions

后端 未结 4 1324
既然无缘
既然无缘 2021-01-13 15:21

My question builds on a similar one by imposing an additional constraint that the name of each variable should appear only once.

Consider a data frame



        
4条回答
  •  独厮守ぢ
    2021-01-13 15:50

    It seems like you can use map2 for this.

    map2_dfc( df[v], f, ~.y(.x))
    
    # # A tibble: 1 x 2
    #   potentially_long_name_i_dont_want_to_type_twice another_annoyingly_long_name
    #                                                                     
    # 1                                             5.5                          255
    

提交回复
热议问题