Skip to content
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

improve+reduce fails+warnings in read+write functions; fix sorting order in quitteSort #84

Merged
merged 5 commits into from
Mar 1, 2024

Conversation

orichters
Copy link
Contributor

  1. If somehow an empty data.frame was written to a mif file and then read with read.quitte, the error message was incomprehensible:
Error in `if (last(period.columns) != length(header)) ...`:
! missing value where TRUE/FALSE needed
Run `rlang::last_trace()` to see where the error occurred.

Now, fail with

No column name found that could be understood as a 4-digit year.
  1. let write.mif and write.IAMCxlsx try to convert to quitte instead of failing immediately, and warn in case of empty data

  2. sort order in quitteSort according to function description, was somehow changed unnoticed in this commit

@orichters orichters changed the title improve+reduce read+write fails+warnings ; fix sorting order in quitteSort improve+reduce fails+warnings in read+write functions; fix sorting order in quitteSort Mar 1, 2024
R/read.quitte.R Outdated Show resolved Hide resolved
arrange(.data$model, .data$scenario, .data$region, .data$variable,
.data$unit, .data$period)
arrange(.data$model, .data$scenario, .data$variable,
.data$unit, .data$region, .data$period)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: unit is superfluous here, as variables can have only one unit by definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only as long as you don't merge GDP (billion US$2010/yr) and GDP (billion US$2005/yr) data into one dataframe. Let us keep it.

R/write.IAMCxlsx.R Outdated Show resolved Hide resolved
@orichters orichters merged commit e8b4d76 into pik-piam:master Mar 1, 2024
4 checks passed
@orichters orichters deleted the smallfix2 branch March 27, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants