1 2R version 3.4.4 (2018-03-15) -- "Someone to Lean On" 3Copyright (C) 2018 The R Foundation for Statistical Computing 4Platform: x86_64-pc-linux-gnu (64-bit) 5 6R is free software and comes with ABSOLUTELY NO WARRANTY. 7You are welcome to redistribute it under certain conditions. 8Type 'license()' or 'licence()' for distribution details. 9 10R is a collaborative project with many contributors. 11Type 'contributors()' for more information and 12'citation()' on how to cite R or R packages in publications. 13 14Type 'demo()' for some demos, 'help()' for on-line help, or 15'help.start()' for an HTML browser interface to help. 16Type 'q()' to quit R. 17 18> library("zoo") 19 20Attaching package: 'zoo' 21 22The following objects are masked from 'package:base': 23 24 as.Date, as.Date.numeric 25 26> 27> target <- c(100, 1, 200, 2, 300) 28> current <- na.fill0(c(NA, 1, NA, 2, NA), c(100, 200, 300)) 29> identical(target, current) 30[1] TRUE 31> 32> target <- structure(c(100, 1, 200, 2), na.action = 5L) 33> current <- na.fill0(c(NA, 1, NA, 2, NA), list(100, 200, NULL)) 34> identical(target, current) 35[1] TRUE 36> 37> target <- structure(c(1, 1, 200, 2), na.action = 5L) 38> current <- na.fill0(c(NA, 1, NA, 2, NA), list("extend", 200, NULL)) 39> identical(target, current) 40[1] TRUE 41> 42> target <- c(1, 1, 200, 2, 2) 43> current <- na.fill0(c(NA, 1, NA, 2, NA), list("extend", 200, "extend")) 44> identical(target, current) 45[1] TRUE 46> 47> target <- structure(c(1, 2), na.action = c(1L, 3L, 5L)) 48> current <- na.fill0(c(NA, 1, NA, 2, NA), list()) 49> identical(target, current) 50[1] TRUE 51> 52> target <- NULL 53> current <- na.fill0(NULL, list(1)) 54> identical(target, current) 55[1] TRUE 56> 57> target <- 1 58> current <- na.fill0(1, list(1)) 59> identical(target, current) 60[1] TRUE 61> 62> target <- 1 63> current <- na.fill0(1, 2) 64> identical(target, current) 65[1] TRUE 66> 67> target <- structure(c(17650, 17650, 0, 17651, 17651), class = "Date") 68> current <- na.fill0(as.Date("2018-04-28") + c(NA, 1, NA, 2, NA), list("extend", as.Date(0))) 69> identical(target, current) 70[1] TRUE 71> 72> target <- structure(c(0, 17650, 0, 17651, 0), class = "Date") 73> current <- na.fill0(as.Date("2018-04-28") + c(NA, 1, NA, 2, NA), as.Date(0)) 74> identical(target, current) 75[1] TRUE 76> 77> proc.time() 78 user system elapsed 79 0.199 0.036 0.224 80