Seems your code needs to be cleaned up a bit:
if(lastFlag!=1){
lastDay <<- rawData$Date[nrow(rawData)] # last complete day
rawData <<- subset.data.frame(rawData,rawData$Date < lastDay)
}
I think the “rawData” could be an empty dataframe here but not be checked;
Let’s suppose:
rawData <- data.frame(x=c(), y=c())
tProcRows <- 100
So:
tProcRows <- tProcRows + as.numeric(row.names(rawData)[nrow(rawData)])
print(tProcRows)
Output:
numeric(0)
2
solved data type conversion in R [closed]