title: Converting day of week to number in R
body: <p>I'm having trouble converting a .csv column of data with weekdays to a number (so that 1 = Monday, 2 = Tuesday, 3 = Wednesday, etc). I'm trying to use the <em>strptime</em> feature as shown here: <a href="http://www.inside-r.org/r-doc/base/strftime" rel="noreferrer">http://www.inside-r.org/r-doc/base/strftime</a></p>
  
  <p>Since I want to convert the weekday to a number, I used the "%u" formatting option. Here's my code below:</p>
  
  <pre><code>&gt; newweekdaynum &lt;- strptime(SFCrimeData$DayOfWeek, "%u")
  </code></pre>
  
  <p>where SFCrimeData is a data set I have that has a bunch of crime information. No errors come up after I run the statement, but when I want to print "newweekdaynum" all that comes is a huge table of values that all say "NA". </p>
  
  <p>What am I doing wrong?</p>