I have a dataframe that looks like this:
> data
Simple feature collection with 176 features and 2 fields
geometry type: POLYGON
dimension: XY
bbox: xmin: 4358985 ymin: 2571551 xmax: 4505751 ymax: 2663100
projected CRS: Lambert_Azimuthal_Equal_Area
First 10 features:
id slide_dates geometry
1 35 12976 POLYGON ((4481002 2663025, ...
2 62 10277 POLYGON ((4472778 2661600, ...
3 82 11400 POLYGON ((4477953 2660650, ...
4 95 8520 POLYGON ((4476978 2658650, ...
5 97 14115 POLYGON ((4474878 2658775, ...
6 166 12017 POLYGON ((4445105 2656175, ...
7 198 10273 POLYGON ((4472753 2655225, ...
8 351 7073 POLYGON ((4467303 2651675, ...
9 377 10149, 16092 POLYGON ((4464129 2652250, ...
10 426 13685 POLYGON ((4432231 2650525, ...
The column slide_dates
is a list with dates stores as integer days after 1970. I would like to replace every element in each list with its "correct" date. I tried several approaches, like this one:
data %>%
mutate(slide_dates = as.Date.numeric(slide_dates, origin="1970-01-01"))
but I get the following error
Fehler: Problem with `mutate()` input `slide_dates`.
x nicht-numerisches Argument für binären Operator
i Input `slide_dates` is `as.Date.numeric(slide_dates, origin = "1970-01-01")`
And I'm not really sure how to solve this problem. Any help is appreciated:)
Some example Data
This gives the same error
df = data.frame(a=1:2)
df$b = list(c(1), c(2, 3))
df %>% mutate(b = as.Date.numeric(b, origin=Sys.Date()))