Talk:List of South American countries by population

Latest comment: 9 months ago by Wizmut in topic Complete update

Reversion edit

As I mentioned to you on the template talk page, Jonesey95, this version you reverted to has far greater problems than a comma on the date. The population figures are completely off from current estimates and the calculated numbers totally divorced from them. Guarapiranga (talk) 06:27, 22 November 2019 (UTC)Reply

The data in the current version of the article is sourced. The version as of 9 November 2019 is full of red error messages, a "Rank" column that is disconnected from the table (and makes no sense if the table is sorted), has year values with commas in them, and much more. This is a live encyclopedia that is shown to readers around the world. If there is a version of the article with accurate data that does not have these rendering errors, use that version. If you can fix the template, do so. – Jonesey95 (talk) 15:12, 22 November 2019 (UTC)Reply
As I said in the template talk page, I couldn't fix it, Jonesey95. You said you can, so why didn't you?
The current data shown, not only is not sourced (calculated figures are divorced from population numbers with no audit trail, i.e. they're not verifiable), but also way out of date. The rank column is not disconnected from the table, it's fixed (as recommended at Help:Tables for tables with more than one sortable column). Guarapiranga (talk) 20:12, 22 November 2019 (UTC)Reply
I played around in the template's sandbox for a bit, created a testcases page, and updated the template's documentation, but it would have taken me multiple hours to learn and re-learn the needed string manipulation templates. I am a volunteer, as are most of us here, and I prefer to spend my time on other tasks. As I said on the template's talk page, I was inclined to let you have the first crack at it. The testcases page should help you. Take one piece at a time. In the meantime, you can update this article if there are new sources; just please don't use buggy templates to do it. – Jonesey95 (talk) 20:36, 22 November 2019 (UTC)Reply
Jonesey95 Guarapiranga The figures on the reversion are a little out of date, I will have a go updating it on the weekend. I think it is a bit of overkill to do a template in order to link it to a population clock; population doesn't change much within 6 to 12 months - the figures just need to be indicitive that you get a relative comparison between countries. Having one respected source for the entire page for these type of demographic and economic country lists (commonly CIA World Factbook, IMF, World Bank) I believe instills a lot more confidence to the reader than linking to seperate sources for every entry, with each country's statistical agency having different methodologies, varied competencies and update frequencies. Maranello10 (talk) 09:57, 28 November 2019 (UTC)Reply
There, fixed and updated to the latest UN figures. Guarapiranga (talk) 23:19, 30 November 2019 (UTC)Reply

Using Lua to get the data edit

Following the discussion at the Village pump, I put together a prototype Lua function to generate a similar table, using the section markup in List of countries by population (United Nations).

{{#invoke:Country population|populations|ARG|BOL|BRA|COL|PER|VEN|XXX|CHL|ECU|PRY|URY|GUY|GUF|SUR|FLK}}
CountryProjected population
(23 April 2024)
Pct of
total
UN Population estimatesAnnual growthDoubling time
(years)
1 July 20231 July 2022IncrementRate
  Brazil217,327,66449.16%216,422,446215,313,4981,108,9480.52%135
  Colombia52,257,35411.82%52,085,16851,874,024211,1440.41%171
  Argentina45,989,15310.40%45,773,88445,510,318263,5660.58%120
  Peru34,600,9967.83%34,352,71934,049,589303,1300.89%78
  Venezuela29,282,1376.62%28,838,49928,301,696536,8031.90%37
  Chile19,650,6244.44%19,629,59019,603,73325,8570.13%526
  Ecuador18,345,9064.15%18,190,48418,001,000189,4841.05%66
  Bolivia12,523,8222.83%12,388,57112,224,110164,4611.35%52
  Paraguay6,927,8651.57%6,861,5246,780,74480,7801.19%59
  Uruguay3,423,3650.77%3,423,1093,422,7943150.01%7,532
  Guyana818,0080.19%813,834808,7265,1080.63%110
  Suriname627,4910.14%623,237618,0415,1960.84%83
  French Guiana318,4680.07%312,155304,5577,5982.49%28
  Falkland Islands3,8000.00%3,7913,780110.29%239
Total442,096,654100%439,719,011436,816,6102,902,4010.66%105

A few comments of differences and issues:

  1. The preprocessor visited node count is only 1,164. This means much larger tables can be used.
  2. The data is sorted. This means if the projected population order changed, this is handled automatically.
  3. I added the two columns for the years with actual data. A proper module could make columns optional.
  4. The total is calculated from the country data.
  5. I still haven't solved the rounding after the maths calcualtions (projected population and doubling time). For some reason the zero precision rounding doesn't work in the function I use after these calculations, but does for the simpler percentage calculations. This is presumably fixable.
  6. The projected population numbers are different. This is because the time factor calculated using {{a.y}} is rounded to 1.4 rather than using higher precision.
  7. This function uses the section markup in the list article. Using data in a subpage is an alternative, that might be easier to update.

If you think this is a good idea, this could be made into a more flexible module. Any thoughts?   Jts1882 | talk  08:17, 9 December 2019 (UTC)Reply

This is excellent, Jts1882, thank you. The only thing I'd like to suggest is using {{significant figures}} for the pcts, so Falkland Islands—or other similarly small entries in other tables—don't show up as zero.
Also, the projected population doesn't need to show decimals (I think).
And if you could go ahead and total the previous population column, so we can fill out the rest of the calculated cells, that'd be great.
For this case, putting the data in a subpage may indeed be the best compromise between flexibility and stability, but in others—typically those amalgamating data from various sources, e.g. national population statistics—it may be better to pulling the data via the markup, so common editors without knowledge of Lua can ensure it stays correct and current. Guarapiranga (talk) 08:33, 9 December 2019 (UTC)Reply
This was just a first pass at something that works to show the principle. Now you've shown interest I will put it into a module and organise the code properly. I know there is an issue with the rounding and agree that significant figures is better, but these are details that must have solutions.
An example of a data subpage is this FIFA World Rankings one used for sports rankings tables. They are easily updated with the help of Excel. A module subpage could also hold population data for many years if desired. While there is something to be said for making the pages editable by anyone, the section markup makes it difficult to update. Data only needs to be updated occasionally, while page content describing and putting the data into context remains readily editably. You could argue that removing huge blocks of data tables makes it easier to edit the rest of the content.
I'm going to think about this a bit. Yesterday was just a bored rainy day activity. Please feel free to add any suggestions or ideas here.   Jts1882 | talk  09:31, 9 December 2019 (UTC)Reply
As for markup, what I found is that it doesn't stand in the way of edits via VE; VE simply puts the cell contents first in the cell, so the beginning section markup needs to be put at the end of the formatting part of the cell, e.g.:
| style="…" <section begin=name1/> | cell 1 || <section end=name1/> style="…" <section begin=name2/> | cell 2 || <section end=name2/> …
Guarapiranga (talk) 21:48, 9 December 2019 (UTC)Reply

Update edit

I've created Module:Country population and the table above now uses the updated version. The only thing I haven't done is put significant figures on the % of total column. I'm looking for the best way of doing this. It's probably best if this is called from a template, which will need a few changes. Any thoughts on template name? Or should it just be an option for {{Country population}}?   Jts1882 | talk  16:52, 10 December 2019 (UTC)Reply

I've added a piechart function.

South American population by country (top 10)

  Brazil (49.2%)
  Colombia (11.8%)
  Argentina (10.4%)
  Peru (7.8%)
  Venezuela (6.6%)
  Chile (4.5%)
  Ecuador (4.1%)
  Bolivia (2.8%)
  Paraguay (1.6%)
  Uruguay (0.8%)
  Other (0.4%)
{{#invoke:Country population|piechart|ARG|BOL|BRA|COL|PER|VEN|XXX|CHL|ECU|PRY|URY|GUY|GUF|SUR|FLK
|caption=South American population by country (top 10)
|slices=10
|other=yes}}
It is a wrapper for the {{Pie chart}} but automatically retrieves the data for the listed countries from the UN population article for the |label= and |value= parameters. The |slices= parameter determines the number of countries to show as slices, with the remainder going in other.   Jts1882 | talk  08:13, 14 December 2019 (UTC)Reply
@Jts1882: Is the module ready for release? The article is broken and fixing it would be ugly. It relies on lots of code to extract numbers from named sections which complicates the wikitext. I believe the fundamental problem at the moment is that the total is calculated by an amazing template which adds up numbers from various named sections. However, that total is used to generate the pie chart, and adjusting the total section to include the total template does not work. Before the last edit, a hard-coded value for the total made the pie chart work, but there were then two total values (slightly disagreeing which each other!) and they were concatenated in the article. Johnuniq (talk) 09:49, 7 June 2020 (UTC)Reply
@Johnuniq: I haven't done anything since the above comment; the discussion petered out. It looks like it is getting the numbers from the UN population page correctly and both table and piechart look OK. It would be best if someone else can double check the numbers, but the current state of the article is far from ideal. I think it's ready to fix this article, but if it is to be used more widely would need further work.
The thing I couldn't get to work properly was the static rank column. It is fine most of the time, but fails to align on some screen sizes and zooms, which is unsatisfactory. —  Jts1882 | talk  11:53, 7 June 2020 (UTC)Reply
@Jts1882: Thanks, that's much better! One glitch is that you have a nice minus sign for Venezuala's increment, but just a hyphen for the negative percentage. If you fix that, please also remove the hidden comment in line 2 of the article which complains about the hyphen that occurred from the old wikitext. I gave the numbers a rough check and they seem good. I know very little about complex tables but I wouldn't think it was possible to have the static rank column always aligned. You could incorporate it into the table as was done before which would make it not static—that could be regarded as a feature? Anyway, it's working and is much cleaner. Johnuniq (talk) 04:09, 8 June 2020 (UTC)Reply

Remove numbering for French Guiana and Falkland Islands? edit

Can we remove the numbering for dependent territories, similar to what is done on the List of Oceanian countries by population and the List of European countries by population? Cstanford.math (talk) 20:05, 2 September 2021 (UTC)Reply

I've added handling for a norank parameter, e.g. |norank=FLK,GUF by Module:Country population.
This adds the class static-row-numbers-norank which suppresses the display of rank and increment for the automatic row numbering using {{static row numbers}} and templatestyles. This new class can be used in any table using {{static row numbers}}. —  Jts1882 | talk  09:07, 3 September 2021 (UTC)Reply
Awesome, that's great that there's already a parameter for that. Thanks! Cstanford.math (talk) 00:05, 4 September 2021 (UTC)Reply

Complete update edit

I have added official figures and dates with detailed sources, so that the article no longer relies on a single source. To make room, I removed the doubling time and absolute change columns. I also added a map and tweaked the pie chart and See also section. I made a column for notes but there are currently none. Wizmut (talk) 03:27, 28 June 2023 (UTC)Reply