-1

My CSV looks as follows like this

But when I read it in R, it changes the format for Date and Time(most important issue). This

Here is my simple code that I used to read the csv

library(readr)
dat1<- read_csv("2010.csv")

How can I make it so that the format for date and time doesn't change and looks like the first picture?

Dean
  • 33
  • 5

1 Answers1

0

Try:

dat1 <- read.table("2010.csv", sep = ",", header = T)

If this answer goes wrong, then:

First check exactly what's in your .csv by opening it with text or some code editors instead of Excel or something like that. The problem I think maybe is that some APP like MS Excel, it will do some auto format converting in preview mode, so what you saw may be not what's really in your file.

For example: 2015-1-1 in .csv when open with Excel, it becomes 2015/1/1

xtluo
  • 1,961
  • 18
  • 26