Hi Everyone! I am new in the Data Analyst´s world and I am working in my first project, but im having some trouble dealing with dates in the data frame that I have created. The problem is that R is changing the dates and I dont understand why. 'Im pretty sure that is a roockie error and I hope someone of the community can help me.
#First I created the data frame (previosly loaded tidyverse and lubridate)
Date <- c(2004-01-01, 2005-01-01, 2006-01-01, 2007-01-01, 2008-01-01, 2009-01-01, 2010-01-01, 2011-01-01, 2012-01-01, 2013-01-01, 2014-01-01, 2015-01-01, 2016-01-01, 2017-01-01, 2018-01-01, 2019-01-01, 2020-01-01)
Inflation <- c(0.1836, 0.1031, 0.1374, 0.1494, 0.2317, 0.1538, 0.2091, 0.2370, 0.2231, 0.2395, 0.4028, 0.2658, 0.4112, 0.2601, 0.4001, 0.5062, 0.3984)
inflation.argentina <- data.frame(Date, Inflation)
#After that I wrote the head() function and something weird happen with the dates (starts in 2002 instead of 2004 and only shows the year).
head(inflation.argentina)
After that, I've changed the class hoping to fix this error but I keep having the wrong dates (Now it show the full date but it starts in 2009-06-25 and with one-day progression instead of one-year progression)
inflation.argentina$Date <- as.Date(inflation.argentina$Date, origin = "2004-01-01")
head(inflation.argentina)