Sometimes we need to change the data type (class, mode) of a variable in R. There are various possible conversions, performed by functions like as.integer, as.factor or as.character. If we need to perform the same conversion on a number of variables (columns) in a data frame, we can convert them all simultaneously using the multConvert function, now included in the fuzzySim package (Barbosa, 2015).
[presented with Pretty R]
By default it converts all the columns in the data frame, but you can specify just a few colums — for example:
multConvert can also be used to apply other kinds of transformations. For example, if you need to divide some of your columns by 100, just write a function to do this and then use multConvert to apply this function to any group of columns:
Barbosa A.M. (2015) fuzzySim: applying fuzzy logic to binary similarity indices in ecology. Methods in Ecology and Evolution, 6: 853-858