Reputation: 13
Hi I have data in a CSV file which has two date columns(1st and 3rd). When I type in R:
library(tidyverse)
mydata <- read_csv("Dynamic AA.csv", col_types = "DdDd")
It imports the data but both the date columns have only NA values. The data was not imported. Following error is produced:
Warning: 8842 parsing failures.
row col expected actual file
1 Date_Debt date like 06/19/20 'Dynamic AA.csv'
1 Date_NIFTY date like 06/19/20 'Dynamic AA.csv'
2 Date_Debt date like 06/18/20 'Dynamic AA.csv'
2 Date_NIFTY date like 06/18/20 'Dynamic AA.csv'
3 Date_Debt date like 06/17/20 'Dynamic AA.csv'
... .......... .......... ........ ................
See problems(...) for more details.
The date is in the standard R format.
Upvotes: 1
Views: 1135
Reputation: 6222
I think the problem is that the date format is not specified. Something like in the following should work.
mydata <- read_csv("Dynamic AA.csv", col_types = cols(
Date_Debt = col_date("%m/%d/%y"),
scnd_col = col_double(),
Date_NIFTY = col_date("%m/%d/%y"),
forth_col = col_double()))
Upvotes: 1