The padr tag refers to the package(padr), in the R programming language. Use this tag for questions regarding this package. The subjects of questions generally asked about this tag are: missing data in time series, N/A values in time series, time interval checks, padding data, and date time formatting & analysis. Use this tag if you are using the functions pad() or thicken(). Please use this tag in conjunction with the tag, r.

The package "padr" is very useful for date-time data sets. It can be used to "fill in the blanks" (with N/A values), in time and date series.

The function pad() allows the user to search through their data frame by many variables, ex. 15 minutes, 1 day, 1 month etc. When the function finds a change in time longer than the user specified interval it assigns it an N/A value.

These N/A values can be replaced later on using functions such as "na.locf" from the "zoo" package, or can just be used to see where ones' data is missing.

Example:

library(padr)

#Example Dates
datetime<-c(Sys.Date(),Sys.Date()+2,Sys.Date()+3,Sys.Date()+5)

#Example Data
data<-c(1,2,3,4)

#Create Df
Df<-data.frame(datetime,data)


#We can see we are missing two dates here!
>Df
    datetime data
1 2017-08-16    1
2 2017-08-18    2
3 2017-08-19    3
4 2017-08-21    4

#Default Pad function has interval='day'
pad(Df)

#Now padded data

pad applied on the interval: day

>Df
datetime data
1 2017-08-16    1
2 2017-08-17   NA
3 2017-08-18    2
4 2017-08-19    3
5 2017-08-20   NA
6 2017-08-21    4

Here is a slightly more complex example using a 15 minute interval

#Example Dates
Dates<-c("2012-09-28 08:00","2012-09-28 08:15","2012-09-28 08:45")

#Since this is an example we must convert the character dates to POSIXct
Dates<-as.POSIXct(Dates, format="%Y-%m-%d %H:%M")

#Example Data
Data<-c(1,2,3)

#Creat Df
DF<-data.frame(Dates,Data)

#We can see we are missing  a 15 min interval at 8:30
>DF
                Dates Data
1 2012-09-28 08:00:00    1
2 2012-09-28 08:15:00    2
3 2012-09-28 08:45:00    3

#Pad on interval= 15 min
PaddedDF<-pad(DF, interval='15 min')

>PaddedDF
                Dates Data
1 2012-09-28 08:00:00    1
2 2012-09-28 08:15:00    2
3 2012-09-28 08:30:00   NA
4 2012-09-28 08:45:00    3