Managing Missing Time Stamps - R or Excel

Hi everyone!

I was wondering if anyone had a way to programmatically deal with missing PurpleAir time stamps, in either R or Excel? We primarily use hourly averages and query the sensor with PurpleAir’s API in R. I am left with a large csv file from the compiled text file queries. My script doesn’t leave blanks for missing time stamps, but I would like it to since I use Excel to roll up the hourly averages into 24hr, so the missing time stamps are important for me

I was wondering if anyone currently uses a code or method in either R or Excel to add in the missing time stamps?


A quick fix that I’ve seen is merging the PurpleAir data with a dataframe/table that has a DateTime column of the dates/times that would be complete for that time period.


this was helpful - thank you! i am very much new to some of these tools :slight_smile:

You can use the padr package to add missing datetime rows - here is the documentation.

thanks! just unsure how to convert the character EST time stamps to POSIXct or POSIXlt that padr needs for the entire time_stamp column.

edit - just figured it out haha. thanks, i’ll try padr!!

1 Like