I am trying to do a spectral density analysis with ozone data but have run into the error:
Error in ts(tser, frequency = x.fsamp, start = x.start) : 'ts' object must have one or more observations
I am not sure what the problem is because it sounds like it is having a problem with the number of entries in the file but the file is certainly not empty. What could be causing this problem? The code is as follows:
library(openair)
library(psd)
filedir <-"C:/Users/dfmcg/Documents/Thesis files/ALL_GPMP_O3_Met"
myfiles <-c(list.files(path = filedir))
paste(filedir,myfiles,sep = '/')
npsfiles<-c(paste(filedir,myfiles,sep = '/'))
for (i in npsfiles[1:3]){
x <- substr(i,55,61)
y<-paste(paste('C:/Users/dfmcg/Documents/Thesis files/nps images',x,sep='/'), '.png', sep='')
png(filename = y)
timeozone<-import(i,date="DATE",date.format = "%m/%d/%Y %H",header=TRUE,na.strings="-999")
psdcore(timeozone, ntaper = ,
na.action = "-999", plot = TRUE,
refresh = TRUE)
dev()
}