-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added bar option to timeseries_plot, fixed tests for climatic_summary and added further tests #56
Conversation
…ggplot2 functions
x_daily <- niger %>% | ||
group_by(date) %>% | ||
summarise(mean_rain = mean(rain), st_dv_rain = sd(rain), n_na_rain = naflex::na_n(rain)) | ||
|
||
x_monthly <- niger %>% | ||
group_by(station_name, year, month) %>% | ||
summarise(mean_rain = mean(rain), st_dv_rain = sd(rain), n_na_rain = naflex::na_n(rain)) | ||
|
||
x_annual <- niger %>% | ||
group_by(station_name, year) %>% | ||
summarise(mean_rain = mean(rain), st_dv_rain = sd(rain), n_na_rain = naflex::na_n(rain)) | ||
|
||
x_station <- niger %>% | ||
group_by(station_name) %>% | ||
summarise(mean_rain = mean(rain), st_dv_rain = sd(rain), n_na_rain = naflex::na_n(rain)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HawardKetoyoMsatsi See here how I fixed the tests. For many examples you weren't grouping by station too.
niger <- daily_niger %>% | ||
filter(year %in% 1950:1951) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HawardKetoyoMsatsi I also restricted the data to two years to reduce the time it takes to run tests. This should still give enough data to check correctness.
t1 <- timeseries_plot(data = niger50, date_time = "date", elements = "tmax", | ||
station = "station_name", facets = "stations") | ||
r1 <- ggplot(niger50, aes(x = date, y = tmax)) + | ||
geom_line() + | ||
facet_wrap(vars(station_name)) | ||
expect_equal(gg_data(t1), gg_data(r1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lilyclements @HawardKetoyoMsatsi See here I have created a function gg_data
which extracts the data that's plotted in a gg graph. So it's a good way to roughly check they are equal - on variables, layers, aesthetics and facets. It won't check theme aspects, we could think of adding functions to do this later.
niger50 <- daily_niger %>% | ||
dplyr::filter(year == 1950) | ||
|
||
agades <- niger50 %>% | ||
dplyr::filter(station_name == "Agades") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lilyclements @HawardKetoyoMsatsi Here I've made two smaller data sets so that testing is efficient.
the bar option allows for doing graphs in #12