Skip to content

Issue when your data are too good #2

@kemarshall

Description

@kemarshall

Hi,

I found this a really useful set of functions and I'm really excited to give them a whirl. But there is a bit of an issue if your data are too good--if you're not removing any data then you actually end up with an empty dataframe. Try getInterpolatedDataByCity("Vancouver, Canada",station.list,10,2015,2016,100,6,0.3) for an example.

So I managed to figure out where the bugs that cause this are. The first is in the combineWeatherDFs function where trackNull <- which(names(dfList$station_data)=="" | names(dfList$station_data) %in% NA) returns a logical(0) if you have data without any issues, which ends up removing all your data in the next line. I kludged through it by adding trackNull <- c(trackNull,1000) as a next line here, but I'm sure there's a more elegant solution for that.

The next bug is in the filterStationData function where rm.df <- data.frame(table(substr(rm.all, 1, nchar(rm.all)-7))) returns a null frame if there is nothing to substring out. I fixed it by adding this next if(dim(rm.df)[1] == 0) { rm.df <- kept.df }. Again, not the tidiest but it seemed to work.

Anyway, I hope this helps and I'm super excited to see this package in more use!

Cheers,
Katie

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions