title: How to convert Date format to numbers to plot density curve
body: <p>I have a data set that has a column named date (with 6000 rows)in this form:</p>
  <pre><code>df$newdate&lt;-format(df$newdate, &quot;%a %H:%M:%S&quot;);
  Mon 16:16:59
  Tue 11:09:55 
  Thu 08:49:42
  ...
  </code></pre>
  <p>I like to plot the density curve. In order to do that I need to convert dates to the numerical value. I would like to use this formula:</p>
  <p>(day of week-1)*24 + hour + minute/60 + second/3600</p>
  <p>so for example in the first row of the new date column, I want to have
  (Monday-1)*24+16+16/60+59/3600</p>
  <p>I have a hard time extracting weekdays and convert them to numbers.
  Here is what I did so far:</p>
  <pre><code>test&lt;-strptime(as.character(df$newdate),format=&quot;%a %H:%M:%S&quot;)
  x&lt;-hour(test)+ (minute(test)/60) + (second(test) / 3600)
  plot(density(x));
  </code></pre>
  <p>for some reason when I ran weekdays(test) only one weekday shows up.
  Could you please help me figure this out?</p>