Hi everybody, I’m new to R and i’m trying to learn fundamentals. I’m facing a small problem for which i can’t find a solution online.
What i want to do: write a function to lower case for all the columns in my data.frame if they respect a condition (class = factor) This code works, but for all my columns : change_lower = function(x) {data.frame(tolower(as.matrix(x)))} I need more something like this, but it doesn’t work: function (x) { for (i in 1:length(x)) { if (class(i)=="factor") { data.frame(tolower(as.matrix(x))) } }} Thank you Yahya ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.