#I have a dataframe with colnames as characther. The dataframe is updated every day. #I need to make a timeline graph, and therefore the colnames for the dynamic data collection is in date-format.
#I downloads the df here:
df_death <- read.csv2("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv" ,
header = TRUE,sep = ",", quote = "\\\"")
#The colnames after [1:4] starts with X1.22.20, i interpret this as month.day.year.
#Before I solve the dates, i format the first four columns into:
df_death$Province.State <- as.factor(jsse_death$Province.State)
df_death$Country.Region <- as.factor(jsse_death$Country.Region)
df_death$Lat <- as.numeric(jsse_death$Lat)
df_death$Long <- as.numeric(jsse_death$Long)
#Then, I filter out the focal country:
df_death_Nor <- jsse_death %>%
filter(Country.Region == "Norway")
#convert the colnames into date-format:
names(df_death_Nor)[-1:-4] <- as.Date(names(df_death_Nor)[-1:-4],format="X%M.%d.%y")
#This results in five-digits integers, where first date-column has 18404. #The origin for this (if its a date) date should be 1969-09-02, to receive 2020-01-22, the correct date.
Hope some of you experts could help me with this.