Skip to content
Prev 389261 / 398506 Next

how to remove factors from whole dataframe?

Hi Luigi,
It's easy:

df1<-df[,!unlist(lapply(df,is.factor))]

_except_ when there is only one column left, as in your example. In
that case, you will have to coerce the resulting vector back into a
one column data frame.

Jim
On Sun, Sep 19, 2021 at 6:18 PM Luigi Marongiu <marongiu.luigi at gmail.com> wrote: