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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -