title: How to change data type of column in Data frame to Date from Char
body: <p>I'm messing with some columns in R using RStudio and have tried to change the data type of one of the columns from Char to Date.</p>
  
  <p>I have used a few options and the one that came the closest was</p>
  
  <pre><code>data$Date &lt;- as.Date(as.character(data$Date))
  </code></pre>
  
  <p>Though even this doesn't seem to work as it changes the values of the column to some weird values</p>
  
  <p>i.e. from</p>
  
  <p><a href="https://i.stack.imgur.com/vRC8U.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vRC8U.png" alt="enter image description here"></a></p>
  
  <p>To something like </p>
  
  <p><a href="https://i.stack.imgur.com/ZRsHw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZRsHw.png" alt="enter image description here"></a></p>
  
  <p>I can't quite figure out why the transformation isn't working. </p>
  
  <p>Here is my code up until that point</p>
  
  <pre><code># load the tidyverse library
  library("tidyverse")
  setwd("C:/Users/ibrahim.cetinkaya/OneDrive - NTT/Desktop/data")
  ##################### Part A #####################
  # data files (you need to specify the paths of the CSV files (e.g. relativeor absolute) )
  files &lt;- c("data/201808.csv",
         "data/201809.csv",
         "data/201810.csv",
         "data/201811.csv",
         "data/201812.csv",
         "data/201901.csv",
         "data/201902.csv",
         "data/201903.csv",
         "data/201904.csv",
         "data/201905.csv",
         "data/201906.csv",
         "data/201908.csv"
  )
  
  #Concatenate into one data frame. 
  data &lt;- data.frame()
  for (i in 1:length(files)){
    temp &lt;- read_csv(files[i], skip = 7)
    data &lt;- rbind(data, temp)
  }
  #View to verify
  view(data)
  
  #Part 2
  #Remove vairables which have no data at all (All the data are na's)
  #Remove variables that doesn't have adequate data (70% of the number of records are NA's)
  data &lt;- data[rowMeans(is.na(data))&lt;=0.9,]
  view(data)
  
  
  #Change the column names to have no spaces between the words
  
  names(data) &lt;- gsub(" ", "_", names(data))
  view(data)
  
  
  #Convert Date to date type
  
  #df2 &lt;- data %&gt;% mutate_at(vars(data), as.Date, format="%m-%d-%Y")
  
  #data %&gt;% mutate(data$Date==as.Date(Date, format = "%m.%d.%Y"))
  data$Date &lt;- as.Date(as.character(data$Date))
  #^^^ This doesn't seem to be working properly ^^^
  
  
  #Checking if it worked
  typeof(data$Date)
  view(data)
  </code></pre>
  
  <p>Any suggestions would be appreciated. 
  I want to be able to change the data type and then extract the month and use it for grouping some of the other data in my frame.</p>