The R data is loaded from the csv file. The Date column must be converted to a "дд/мм/гггг". date "дд/мм/гггг".

When downloading from the csv file, the date entry in the date column looks like this 02.01.2016.

Attempt to convert by the following expression:

 date_SaleData <- as.Date(SaleData$Date, "%dd/%mm/%yyyy") 

It leads to the fact that when viewing date_SaleData there are only "NA" .

    1 answer 1

    You specify an incorrect date format (pattern). Correct values ​​can be found on the strptime function help page. If the data has the form DD.MM.YYYY , then when DD.MM.YYYY , you need to specify this format exactly, but use the correct notation.

     str(as.Date("12.03.2016", "%d.%m.%Y")) #> Date[1:1], format: "2016-03-12" 
    • Hello, thank you, helped. Just why it was necessary to replace the dots with slashes. - Qwery Walter
    • If in the data of a point, specify in a format of parsing of a point. If the slashes, then specify slashes. - Artem Klevtsov