title: Plot a histogram of subset of a data
body: <p>!<a href="http://i.stack.imgur.com/TB3HK.png" rel="nofollow">The image shows the screen shot of the .txt file of the data.
  The data consists of 2,075,259 rows and 9 columns</a></p>
  
  <p>Measurements of electric power consumption in one household with a one-minute sampling rate over a period of almost 4 years. Different electrical quantities and some sub-metering values are available. </p>
  
  <p>Only data from the dates 2007-02-01 and 2007-02-02 is needed.
  I was trying to plot a histogram of "Global_active_power" in the above mentioned dates.</p>
  
  <p>Note that in this dataset missing values are coded as "?"]</p>
  
  <p>This is the code i was trying to plot the histogram:</p>
  
  <pre><code>{
  
  data &lt;- read.table("household_power_consumption.txt", header=TRUE)
  my_data &lt;- data[data$Date %in% as.Date(c('01/02/2007', '02/02/2007'))]
  
  my_data &lt;- gsub(";", " ", my_data)    # replace ";" with " "  
  my_data &lt;- gsub("?", "NA", my_data)   # convert "?" to "NA"
  my_data &lt;- as.numeric(my_data)      # turn into numbers
  
  hist(my_data["Global_active_power"])
  
  }
  </code></pre>
  
  <p>After running the code it is showing this error:</p>
  
  <p>Error in hist.default(my_data["Global_active_power"]) : 
  invalid number of 'breaks'</p>
  
  <p>Can you please help me spot the mistake in the code.</p>
  
  <p>Link of the data file : <a href="https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip" rel="nofollow">https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip</a></p>