I have this data frame:
DF
V1 V2
P1 03.02.2020
22 04.02.2020
33 05.02.2020
P2 05.02.2020
P1 06.02.2020
And I would like to have this output
DF
V1 V2 V3
P1 03.02.2020 P1
22 04.02.2020 NA
33 05.02.2020 NA
R2 05.02.2020 R2
S3 06.02.2020 S3
In V3 I would like to have only string contains a letter from V1.
I used this code
DF %>% mutate(V3 = grep("([A-Z])", V1))
But I got this error:
x Input
typ
can't be recycled to size
How could I fix this?