<div dir="ltr">Hi Emil,<div><br></div><div>This mailing list is only for the data.table package. Find out about other lists here: <a href="https://www.r-project.org/mail.html">https://www.r-project.org/mail.html</a></div><div><br></div><div>For reference, you probably want to link your SO post</div><div><a href="http://stackoverflow.com/q/37819796/1191259">http://stackoverflow.com/q/37819796/1191259</a><br></div><div><br></div><div>--Frank</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 14, 2016 at 2:34 PM, phdmonster <span dir="ltr"><<a href="mailto:emillfilipov@gmail.com" target="_blank">emillfilipov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This here bugger worked perfectly until i changed the data set:<br>
<br>
    for (k in m) {<br>
    mos_sub <- subset(work_table_ansfreq, !<a href="http://is.na" rel="noreferrer" target="_blank">is.na</a>(work_table_ansfreq[,r]) &<br>
work_table_ansfreq$MOS_GROUP==k & !<a href="http://is.na" rel="noreferrer" target="_blank">is.na</a>(work_table_ansfreq$MOS_GROUP))<br>
    freq_mos<- table(mos_sub[,r])<br>
    qa[,k] <- freq_mos<br>
    }<br>
For some reason it removes both NA values (which is normal) and one column<br>
that actually has values. I will demonstrate. Output of the above code is:<br>
<br>
    I provide care for someone who suffers from<br>
Not applicable                        Prefer not to answer<br>
                                          4<br>
631                                          14<br>
       Someone in my household suffers from<br>
                                          1<br>
And when i include **exclude = NULL** in the table brackets i get this:<br>
<br>
    I provide care for someone who suffers from<br>
I suffer from                              Not applicable<br>
                                             22<br>
6                                        5258<br>
                           Prefer not to answer        Someone in my<br>
household suffers from                                        <NA><br>
                                             94<br>
13                                           0<br>
<br>
How do i fix this? Meaning how do i exclude only the NA which should be the<br>
only one excluded from the table anyway.<br>
Thanks!<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://r.789695.n4.nabble.com/Table-function-deletes-non-NA-values-in-R-tp4721792.html" rel="noreferrer" target="_blank">http://r.789695.n4.nabble.com/Table-function-deletes-non-NA-values-in-R-tp4721792.html</a><br>
Sent from the datatable-help mailing list archive at Nabble.com.<br>
_______________________________________________<br>
datatable-help mailing list<br>
<a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
</blockquote></div><br></div>