convert a data frame from lowercase to uppercase

convertir todos los datos categoricos de un data frame de minusculas a mayusculas y al contrario
he consultado pero solo encuentro convertir un vector y quiero convertir cualquier dataframe que suba a la aplicacion
utilizo toupper(data frame)
pero me sale error data' must be 2-dimensional (e.g. data frame or matrix)

Like this?

#Invent some data
DF <- data.frame(Treat = letters[1:5],
                 Treat2 = letters[11:15],
                 Treat3 = 1:5,
                 Treat4 = letters[21:25]
                 , stringsAsFactors = FALSE)
DF
#>   Treat Treat2 Treat3 Treat4
#> 1     a      k      1      u
#> 2     b      l      2      v
#> 3     c      m      3      w
#> 4     d      n      4      x
#> 5     e      o      5      y
library(dplyr)
DF2 <- mutate_if(DF, is.character, toupper)
DF2
#>   Treat Treat2 Treat3 Treat4
#> 1     A      K      1      U
#> 2     B      L      2      V
#> 3     C      M      3      W
#> 4     D      N      4      X
#> 5     E      O      5      Y

Created on 2020-01-19 by the reprex package (v0.3.0)

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.