title: Trying to Convert String to Data in R, getting Error in `$<-.data.frame`(`*tmp*`, Date, value = numeric(0)) : replacement has 0 rows, data has 500
body: <p>Date is really one of the columns and it's a <code>char</code> type; trying to make it <code>Date</code>:</p>
  <pre><code>if (!require(tidyverse)) install.packages(&quot;tidyverse&quot;)
  library(tidyverse)
  library(PerformanceAnalytics)
  library(xts)
  library(lubridate)
  
  bshi &lt;- read.csv(&quot;myfile.csv&quot;)
  #Date is really one of the columns and its a &quot;char&quot; type, trying to make it date
  
  bshi$Date &lt;-mdy(bshi$Date)
  str(bshi)
  
  bshi$Date &lt;-as.Date(bshi$Date, format =  &quot;%m/%d/%Y&quot;)
  str(bshi)
  
  #neither work
  
  #update:  I used colnames(&lt;dataframe&gt;) and found out the column name was not what I thought it was and fixed this
  </code></pre>