Skip to content

Typologies Spain#37

Open
AliceBeckmann wants to merge 110 commits intomainfrom
alice/typologies
Open

Typologies Spain#37
AliceBeckmann wants to merge 110 commits intomainfrom
alice/typologies

Conversation

@AliceBeckmann
Copy link
Copy Markdown
Collaborator

No description provided.

@AliceBeckmann AliceBeckmann requested a review from lbm364dl July 17, 2025 11:10
@lbm364dl lbm364dl added this to the v0.2.0 milestone Jul 22, 2025
@lbm364dl lbm364dl added the enhancement New feature or request label Jul 22, 2025
@lbm364dl lbm364dl force-pushed the alice/model-grafs-spain branch from 98fb05d to 46b433d Compare August 14, 2025 14:35
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

air

[air] reported by reviewdog 🐶


[air] reported by reviewdog 🐶

whep/R/Typologies_Josette.R

Lines 623 to 627 in 2daf52f

p_typology_stack <- ggplot2::ggplot(df_total_input_typ, ggplot2::aes(
x = factor(Year),
y = Total_N_input,
fill = Typology
)) +


[air] reported by reviewdog 🐶


[air] reported by reviewdog 🐶

whep/R/Typologies_Josette.R

Lines 678 to 682 in 2daf52f

p_typology_pct <- ggplot2::ggplot(df_total_input_typ_pct, ggplot2::aes(
x = factor(Year),
y = Percent_N_input,
fill = Typology
)) +


[air] reported by reviewdog 🐶

data$Livestock_Prod_ygps$Province_name, "Latin-ASCII"


[air] reported by reviewdog 🐶

data$sf_provinces <- data$sf_provinces[!data$sf_provinces$name %in% c(
"Las_Palmas", "Tenerife"
), ]


[air] reported by reviewdog 🐶

data$GRAFS_Prod_Destiny_git, lu_aggregated


[air] reported by reviewdog 🐶

data$PIE_FullDestinies_FM, lu_aggregated


[air] reported by reviewdog 🐶

whep/R/Typologies_Julia.R

Lines 148 to 150 in 2daf52f

sf_provinces_spain <- sf::st_read(shapefile_path, query = paste0(
"SELECT * FROM ", layer_name, " WHERE iso_a2 = 'ES'"
))


[air] reported by reviewdog 🐶

Codes_coefs = readxl::read_excel(file.path(inputs_dir, "Codes_coefs.xlsx"),


[air] reported by reviewdog 🐶

inputs_dir, "GRAFS_Prod_Destiny_git.csv"


[air] reported by reviewdog 🐶

inputs_dir, "PIE_FullDestinies_FM.csv"


[air] reported by reviewdog 🐶

whep/R/Typologies_Julia.R

Lines 177 to 186 in 2daf52f

~Livestock_cat, ~Animal_class,
"Cattle_milk", "Dairy_cows",
"Cattle_meat", "Cattle",
"Sheep", "Sheep_goats",
"Goats", "Sheep_goats",
"Donkeys_mules", "Equines",
"Horses", "Equines",
"Pigs", "Pigs",
"Poultry", "Hens",
"Rabbits", "Rabbits"


[air] reported by reviewdog 🐶

whep/R/Typologies_Julia.R

Lines 219 to 220 in 2daf52f

Year, Province_name, Livestock_cat, Animal_class,
Stock_Number, LU_head, LU_total


[air] reported by reviewdog 🐶

whep/R/Typologies_Julia.R

Lines 238 to 241 in 2daf52f

dplyr::summarise(LU_total = sum(
LU_total,
na.rm = TRUE
), .groups = "drop") |>


[air] reported by reviewdog 🐶

whep/R/Typologies_Julia.R

Lines 259 to 262 in 2daf52f

dplyr::summarise(Area_ha = sum(
Area_ygpit_ha,
na.rm = TRUE
), .groups = "drop")


[air] reported by reviewdog 🐶

whep/R/Typologies_Julia.R

Lines 322 to 325 in 2daf52f

dplyr::summarise(Semi_nat_feed_MgN = sum(
MgN,
na.rm = TRUE
), .groups = "drop")


[air] reported by reviewdog 🐶

whep/R/Typologies_Julia.R

Lines 341 to 344 in 2daf52f

dplyr::summarise(Cropland_feed_MgN = sum(
MgN,
na.rm = TRUE
), .groups = "drop")


[air] reported by reviewdog 🐶

whep/R/Typologies_Julia.R

Lines 362 to 365 in 2daf52f

dplyr::summarise(Total_feed_MgN = sum(
MgN,
na.rm = TRUE
), .groups = "drop") |>


[air] reported by reviewdog 🐶

dplyr::left_join(total_feed, semi_nat_feed,


[air] reported by reviewdog 🐶

is.na(Semi_nat_feed_MgN), 0, Semi_nat_feed_MgN


[air] reported by reviewdog 🐶

whep/R/Typologies_Julia.R

Lines 409 to 412 in 2daf52f

dplyr::summarise(Domestic_feed_MgN = sum(
MgN,
na.rm = TRUE
), .groups = "drop")


[air] reported by reviewdog 🐶

whep/R/Typologies_Julia.R

Lines 436 to 439 in 2daf52f

dplyr::summarise(Total_feed_import = sum(
Value_destiny,
na.rm = TRUE
), .groups = "drop")


[air] reported by reviewdog 🐶

whep/R/Typologies_Julia.R

Lines 443 to 446 in 2daf52f

dplyr::summarise(LU_total_spain = sum(
LU_total,
na.rm = TRUE
), .groups = "drop")


[air] reported by reviewdog 🐶

is.nan(Imported_feed_share), NA, Imported_feed_share


[air] reported by reviewdog 🐶

whep/R/Typologies_Julia.R

Lines 509 to 510 in 2daf52f

livestock_density, productivity, semi_nat_share, imported_feed_share,
sf_provinces, year


[air] reported by reviewdog 🐶

Productivity_kgN_ha > 60 ~ "Specialized cropping system",


[air] reported by reviewdog 🐶

Productivity_kgN_ha <= 60 ~ "Extensive cropping system",


[air] reported by reviewdog 🐶

Semi_nat_share > 0.6 ~ "Extensive mixed crop-livestock system",


[air] reported by reviewdog 🐶

Imported_feed_share < 0.5 ~ "Intensive mixed crop-livestock system",


[air] reported by reviewdog 🐶

Imported_feed_share >= 0.5 ~ "Specialized livestock-farming system",


[air] reported by reviewdog 🐶

Productivity_kgN_ha > 60 ~ "Specialized cropping system",


[air] reported by reviewdog 🐶

Productivity_kgN_ha <= 60 ~ "Extensive cropping system",


[air] reported by reviewdog 🐶

Semi_nat_share > 0.6 ~ "Extensive mixed crop-livestock system",


[air] reported by reviewdog 🐶

Imported_feed_share < 0.5 ~ "Intensive mixed crop-livestock system",


[air] reported by reviewdog 🐶

Imported_feed_share >= 0.5 ~ "Specialized livestock-farming system",

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

air

[air] reported by reviewdog 🐶

Productivity_kgN_ha > 60 ~ "Specialized cropping system",


[air] reported by reviewdog 🐶

Productivity_kgN_ha <= 60 ~ "Extensive cropping system",


[air] reported by reviewdog 🐶

Semi_nat_share > 0.6 ~ "Extensive mixed crop-livestock system",


[air] reported by reviewdog 🐶

Imported_feed_share < 0.5 ~ "Intensive mixed crop-livestock system",


[air] reported by reviewdog 🐶

Imported_feed_share >= 0.5 ~ "Specialized livestock-farming system",

@lbm364dl lbm364dl modified the milestones: v0.3.0, v0.0.4 Feb 27, 2026
AliceBeckmann and others added 26 commits March 9, 2026 12:07
Reset non-typology files (bilateral_trade, gapfilling, production,
livestock, etc.) to main's version. Restore files deleted by stale
sub-branch merges (calculate_lmdi, harmonize, toy_examples).
Keep typology-specific work in n_prov_destiny, n_soil_inputs_nue, utils.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restore example=FALSE parameter to create_n_prov_destiny,
create_n_nat_destiny, create_n_soil_inputs, create_n_production,
calculate_nue_crops, calculate_nue_livestock, calculate_system_nue
to match main's API. Remove non-existent linear_fill, proxy_fill,
sum_fill exports from NAMESPACE.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Accept remote updates to typology plot files (typologies_kgN_ha,
typologies_spain_plot, typologies_spain_stacked_bar). Merge both
sides for DESCRIPTION, _pkgdown.yml, .Rbuildignore, and
whep-package.R. All 473 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These datasets were part of the old version= API approach.
The current example=TRUE pattern uses toy_examples.R instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace @Keywords internal with @nord on dot-prefixed helper
functions to prevent man page generation. Regenerate docs with
devtools::document(), removing 16 dot-prefixed and 3 stale man pages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add rename_with(tolower) at the end of create_n_prov_destiny() and
create_n_soil_inputs() to output snake_case column names (year,
province_name, item, irrig_cat, box, origin, destiny, mg_n) matching
main's API. Update all 15 downstream files (typology classifiers,
grafs_plot, NUE functions, plots) to use snake_case column references.

Add @param example and @examples documentation to all 7 exported
N flow functions. Regenerate man pages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update roxygen @return docs to use snake_case column names matching
the actual output. Remove decorative dashes from exported function
titles. Add detailed column docs to create_n_nat_destiny and irrig_cat
to create_n_soil_inputs. Fix stray character at start of n_prov_destiny.R.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Match main's roxygen style: @param before @return, no decorative
dashes in exported function titles, remove duplicate @param.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merge origin/main into alice/typologies. Keep rename_with(tolower)
only at the public create_n_prov_destiny() boundary, not inside
internal .add_n_soil_inputs. Take main's version for non-typology
files. Add branch-specific typology section to _pkgdown.yml.
Add mipfp, ggpattern, patchwork, sf, readxl, stringi deps for
typology code. 679/684 tests pass (5 pre-existing failures on main).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove linear_fill, proxy_fill, sum_fill from _pkgdown.yml (renamed
to fill_linear, fill_sum, fill_proxy_growth on main). Remove mipfp
from Imports as it is no longer used.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace non-ASCII chars (en-dashes, superscripts) with ASCII in
  intensification_specialization_plot.R and land_use_typology_panel.R.
- Add scales to Imports in DESCRIPTION.
- Add missing globalVariables() for all typology NSE variables.
- Remove Rplots.pdf and typology_kgha_agricultural.jpg from repo.
- Add both to .gitignore.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove explicit return() calls (use implicit returns).
- Shorten function names exceeding 30 chars.
- Fix T symbol to t_ratio (avoids shadowing TRUE).
- Rename recycled_N to recycled_n (snake_case).
- Add spaces after commas in tribble definitions.
- Replace 1:nrow() with seq_len(nrow()).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove explicit return() in land_use_typology_panel.R,
Typologies_Josette.R, typologies_spain_plot.R, typologies_spain.R.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants