I am trying to read a date column from a dataframe, which is stored as a string |(see column 'DateString'. This is how my data looks like:
X. Date_String ASIN Stars positive_rating
1 0 20150430 B00GKKI4IE 5 0
2 1 20150430 B00GKKI4IE 5 0
3 2 20150430 B00GKKI4IE 5 0
4 3 20150429 B00GKKI4IE 5 0
5 4 20150428 B00GKKI4IE 5 0
6 5 20150428 B00GKKI4IE 5 0
and this is what I am using to format this column as Date
data$date.of.review <- as.Date(data$Date_String, "%Y%m%d")
and getting an error message
Error in charToDate(x) :
character string is not in a standard unambiguous format
any ideas how to solve it? thanks
Here is the structure of the dataframe:
structure(list(X. = 0:5, Date_String = c(20150430L, 20150430L,
20150430L, 20150429L, 20150428L, 20150428L), ASIN = structure(c(1L,
1L, 1L, 1L, 1L, 1L), .Label = c("B00GKKI4IE", "B00I4OBXWI", "B00IB17BFM",
"B00IN2WD5C", "B00J58F0IA", "B00K7NCS9G", "B00KJEZIBS", "B00KZER5GS",
"B00MK39H68", "B00O1GTTWY"), class = "factor"), Stars = c(5L,
5L, 5L, 5L, 5L, 5L), positive_rating = c(0, 0, 0, 0, 0, 0)), .Names = c("X.",
"Date_String", "ASIN", "Stars", "positive_rating"), row.names = c(NA,
6L), class = "data.frame")