Apply a function to all the elements of a data frame

后端 未结 2 1445
迷失自我
迷失自我 2021-02-01 23:45

I am trying to apply some transformations to all the elements in a dataframe.

When using the regular apply functions, I get a matrix back and not a dataframe. Is there a

2条回答
  •  一向
    一向 (楼主)
    2021-02-02 00:04

    Here's a way using dplyr:

    library(dplyr)
    df  %>% mutate_each(funs(tolower))
    

提交回复
热议问题