I am trying to convert this large dataset date column, which is the the format (YYYY/MM/DD), I am looking to simply just convert any observation within the 'date' variable to the first day of that corresponding month.(2018/02/03 -> 2018/02/01) I'm am very new with data table, so apologies if this a simple question. Here is sample dput() of my dataset.
structure(list(quantity = c(NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_), price_mid = c(NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_), value_mid = c(100, 241.85, 241.85,
241.85, 241.85, 241.85), currency_price = c("GBP", "GBP", "GBP",
"GBP", "GBP", "GBP"), currency_value = c("GBP", "GBP", "GBP",
"GBP", "GBP", "GBP"), date = structure(c(13515L, 13516L, 13517L,
13518L, 13521L, 13522L), class = "Date")), class = c("data.table",
"data.frame"), row.names = c(NA, -6L), .internal.selfref = <pointer: 0x15f28c0>)
Let me know if any edits on the question is needed. Thanks