Skip to content
Prev 200400 / 398502 Next

lapply() not converting columns to factors (no error message)

A Singh wrote:
Make sure that you are looking in the same object that you changed. E.g.

attach(prmdf)
prmdf[2:13]<-lapply(prmdf[2:13], factor)
levels(P1L55)

is not going to work

levels(prmdf$P1L55)

should, or attaching _after_ the change. Also, make sure that you don't
have P1L55 et al. sitting in the global enviromnent.