Hello,

I need to identify which columns from a data.frame is a factor. Since I
need to test "is.factor" for all columns, I tried the following code:

apply(dataframe, 2, is.factor)

But it always returned FALSE. Then I tried to check the classes of those
columns using:

apply(dataframe, 2, class)

And it always returned "character". Is the related to the fact that apply
function should be applied to arrays or matrixes, and not to data.frames?

So I believe that apply function convert the data.frame into a matrix. And
the class of the matrix will be character if any of its elements is not
numeric.

So, if I my conclusion about apply function is correct, this is not the way
I should proceed. So, how can I get a vector of booleans as result of some
function applied to columns of a data.frame, e.g., is.factor?

Thanks!

Cheers,

João Daniel
UFMG - Brazil

	[[alternative HTML version deleted]]

