title: Is it possible to index out NA's from a column?
body: <p>Iam working R in RStudio and doing some analysis about crimes in chicago. I have a date column in my dataset which I separated into 3 columns (year, month, day). Now I would like to see how many crimes per year happened in which month. My code and filtering is working perfect I just have somewhere in the dataset (in the year, month, day) columns NA's. I tried everything to get them out, but didnt work. Does somebody has any idea how I can get them out, or is it possible to get them out with indexing? For example something like this <code>Year[-NA]</code>.</p>
  
  <p>This is how my code looks like:</p>
  
  <pre><code>library(dplyr)
  library(highcharter)
  library(xts)
  library(tidyverse)
  library(ggplot2)
  library(viridis)
  
  homicide &lt;- cc[cc$Primary.Type == "HOMICIDE",]
  homicideAnalysis &lt;- homicide %&gt;% group_by(Year, Month) %&gt;% summarise(Total = n())
  
  ggplot(homicideAnalysis, aes(Year, Month, fill = Total)) +
    geom_tile(size = 1, color = "white") +
    scale_fill_viridis()  +
    geom_text(aes(label = Total), color='white') +
    ggtitle("Homicides in Chicago") 
  </code></pre>
  
  <p>And here is a screenshot of the plot, where you can see the NA at month and at year:</p>
  
  <p><a href="https://i.stack.imgur.com/XMROy.png" rel="nofollow noreferrer">Homicides in Chicago Plot</a></p>
  
  <p>PS: <code>unique(cc$Year)</code> gives me this output</p>
  
  <pre><code> [1] 04   03   01   02   &lt;NA&gt; 06   05   07   08   09   11   10   16   15   12   14  
  [17] 13   17  
  Levels: 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17
  </code></pre>