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

Model$U and model$U_d not properly indexed #134

Closed
WesIngwersen opened this issue May 25, 2021 · 3 comments
Closed

Model$U and model$U_d not properly indexed #134

WesIngwersen opened this issue May 25, 2021 · 3 comments
Assignees

Comments

@WesIngwersen
Copy link
Collaborator

rownames are missing

@MoLi7
Copy link
Collaborator

MoLi7 commented May 25, 2021

That's odd. I don't see mis-indexed model$U and model$U_d for any of these models: USEEIOv2.0s-GHG, USEEIOv2.0-GHG_nodisagg, and USEEIOv2.0i-GHG_nodisagg.

To confirm it, I added simple check code below right after model$U and model$U_d are created. Could you test it at your end? @WesIngwersen

model$U <- as.matrix(dplyr::bind_rows(cbind(model$UseTransactions,
FinalDemand_df),
model$UseValueAdded)) # Use
if (!identical(rownames(model$U), c(model$Commodities$Code_Loc,
model$ValueAddedSectors$Code_Loc))) {
stop("rownames of model$U are not correct!")
}
model$U_d <- as.matrix(dplyr::bind_rows(cbind(model$DomesticUseTransactions,
DomesticFinalDemand_df),
model$UseValueAdded)) # DomesticUse
if (!identical(rownames(model$U_d), c(model$Commodities$Code_Loc,
model$ValueAddedSectors$Code_Loc))) {
stop("rownames of model$U_d are not correct!")
}

@WesIngwersen
Copy link
Collaborator Author

>   model$U <- as.matrix(dplyr::bind_rows(cbind(model$UseTransactions,
+                                               FinalDemand_df),
+                                         model$UseValueAdded)) # Use
> rownames(model$U)
NULL

I'm suspecting it might be my version of dplyr, which is 0.8.3. i will look up to see if they make some changes in bind_rows() to index rows in a more recent version

@WesIngwersen WesIngwersen self-assigned this May 25, 2021
@WesIngwersen
Copy link
Collaborator Author

Yes that was the issue..it might have been the dplyr dependency vctrs package that was old..an update to the most recent version results in row names being applied in that transformation

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

No branches or pull requests

2 participants