This here bugger worked perfectly until i changed the data set:

    for (k in m) {
    mos_sub <- subset(work_table_ansfreq, !is.na(work_table_ansfreq[,r]) &      
work_table_ansfreq$MOS_GROUP==k & !is.na(work_table_ansfreq$MOS_GROUP))
    freq_mos<- table(mos_sub[,r])
    qa[,k] <- freq_mos
    }
For some reason it removes both NA values (which is normal) and one column
that actually has values. I will demonstrate. Output of the above code is:

    I provide care for someone who suffers from                             
Not applicable                        Prefer not to answer 
                                          4                                     
   
631                                          14 
       Someone in my household suffers from 
                                          1 
And when i include **exclude = NULL** in the table brackets i get this:

    I provide care for someone who suffers from                              
I suffer from                              Not applicable 
                                             22                                 
         
6                                        5258 
                           Prefer not to answer        Someone in my
household suffers from                                        <NA> 
                                             94                                 
        
13                                           0 

How do i fix this? Meaning how do i exclude only the NA which should be the
only one excluded from the table anyway.
Thanks!




--
View this message in context: 
http://r.789695.n4.nabble.com/Table-function-deletes-non-NA-values-in-R-tp4721792.html
Sent from the datatable-help mailing list archive at Nabble.com.
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to