list - remove R level of unlisted object -
i have variable named 'feedb' here when called :
> feedb [[1]] [1] nocoment 319 levels: - --- ... variasu barang ditambah [[2]] [1] mantao 319 levels: - --- ... variasu barang ditambah [[3]] [1] tolong takpilkan no resi pengiriman. 319 levels: - --- ... variasu barang ditambah
i not know '319 levels : - --- ... variasu barang ditambah' comes from. , unlist of variable
abc<-unlist(feedb)
and still has level :
> abc [1] nocoment mantao [3] tolong takpilkan no resi pengiriman. 319 levels: - --- ... variasu barang ditambah
what levels? , how remove it? want abc contains value. tried stringasfactor=false cannot used
we can use droplevels
drop unused levels or call factor
again. should have happened when factor
column or vector
got subsetted, levels
of original vector still remains.
feedb[] <- lapply(feedb, droplevels)
or
feedb[] <- lapply(feedb, factor)
or convert character
feedb[] <- lapply(feedb, as.character)
Comments
Post a Comment