This is the data that I have:
`Fiscal Year` SiteState county StartDate EndDate `Site Type` `Count of Site` `Sum of GallonsAppli~ ndays id
1 FY 18 IA Butler 2017-11-21 2017-11-21 F 3 554700 1 da~ 1
2 FY 18 IA Cerro Gor~ 2017-10-18 2017-10-19 F 1 1124085 2 da~ 2
3 FY 18 IA Cerro Gor~ 2017-10-19 2017-10-19 F 1 478240 1 da~ 3
4 FY 18 IA Cerro Gor~ 2017-10-20 2017-10-20 F 1 201306 1 da~ 4
5 FY 18 IA Cerro Gor~ 2017-10-20 2017-10-21 F 1 973760 2 da~ 5
6 FY 18 IA Cerro Gor~ 2017-10-20 2017-10-23 F 1 784743 4 da~ 6
7 FY 18 IA Cerro Gor~ 2017-10-26 2017-10-26 F 1 246462 1 da~ 7
8 FY 18 IA Cerro Gor~ 2017-10-27 2017-10-29 F 1 561808 3 da~ 8
9 FY 18 IA Cerro Gor~ 2017-10-30 2017-10-30 F 1 519946 1 da~ 9
10 FY 18 IA Cerro Gor~ 2017-11-02 2017-11-02 F 2 816240 1 da~ 10
11 FY 18 IA Cerro Gor~ 2017-11-03 2017-11-08 F 1 1260160 6 da~ 11
12 FY 18 IA Cerro Gor~ 2017-11-04 2017-11-04 F 2 757145 1 da~ 12
13 FY 18 IA Cerro Gor~ 2017-11-05 2017-11-05 F 3 1022532 1 da~ 13
14 FY 18 IA Cerro Gor~ 2017-11-06 2017-11-06 F 1 565500 1 da~ 14
15 FY 18 IA Cerro Gor~ 2017-11-06 2017-11-07 F 1 682500 2 da~ 15
16 FY 18 IA Cerro Gor~ 2017-11-07 2017-11-07 F 3 905442 1 da~ 16
17 FY 18 IA Cerro Gor~ 2017-11-08 2017-11-08 F 1 128880 1 da~ 17
18 FY 18 IA Cerro Gor~ 2017-11-09 2017-11-09 F 2 509776 1 da~ 18
19 FY 18 IA Cerro Gor~ 2017-11-10 2017-11-11 F 1 730916 2 da~ 19
20 FY 18 IA Cerro Gor~ 2017-11-12 2017-11-12 F 1 440577 1 da~ 20
I am trying to create a new data frame with all the fields except the dates. I want to create a new field date that will expand the dates if needed beteen the start date and the end date.
I have tried several ways but I always end getting and Error : 'from' must be of length 1
For example, if I try the simplest way to go,
dates <- seq( from = as.Date(data_clean$StartDate), to = as.Date(data_clean$EndDate), by = 1)
gives me:
Error in seq.Date(from = as.Date(data_clean$StartDate), to = as.Date(data_clean$EndDate), : 'from' must be of length 1
Can anyone help?