'apply complete() function to different RData in the same pc folder

I have a folder in the computer containing 180k different RData all have different names such as 412Z8.ETFMIB

the structure of each of them is similar and like this

investor asset  datetime   Avgprice operation portfolio last_port marketprice portprice     G gainminus numasset
  <chr>    <chr>  <chr>         <dbl>     <dbl>     <dbl>     <dbl>       <dbl>     <dbl> <dbl>     <dbl>    <dbl>
1 412Z8    ETFMIB 2018-11-28     18.7      7200      7200         0        18.7      18.7     0         1        3
2 412Z8    ETFMIB 2018-11-29     18.8     -7200         0      7200        18.8       0       1         0        2

They are all in the same folder "C:/Users/Lorenzo/Desktop/Bologna_R/dev/test-data/investors-rdata-assetbased" I want to apply the function complete() on all the single RData of the folder on the column datetime, which for the moment is a character and should be changed to the correct format.

So to resume I want to change the format of the datetime column and to apply the complete() function on the datetime column (1 day is the unit) to update all the RData with the missing rows for the missing dates between first and last observation



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source