I am specifically interested in soldiers in Europe who were recruited not from nobility. For further simplicity, let's even focus the question on Spain, France, HRE lands.
Was there a screening system that determines how to best assign a particular soldier? Could one switch roles easily ("Can I trade you my arquebus for a pike?")? Or did one have to switch roles over time ("Gee, I lost my halberd so now I have to carry this stupid pike!")?
I can answer this for the early Dutch Republic.
In the Dutch army soldiers had to buy their own weapons. This means that they could decide what 'type' they'd be, and in theory they could switch from one type to another. Weapons were expensive though, so that didn't happen very often.
Of course it's very inconvenient for an army if soldiers can just decide to show up for battle with whatever weapon they happen to prefer that day (I exaggerate a bit). There was a system to manage all of this. The way the Dutch army worked, is that the States General (the body ultimately responsible for the defense of the country) would authorise the recruitment of x number of companies. They'd then find captains for those companies. The captain received a lump sum of money and would be responsible for raising the appropriate number of troops.
At first there were no requirements to what types of soldiers should be in the companies. Anyone could bring whatever weapon they liked. This resulted in the majority of soldiers being armed with calivers (a type of arquebus), as they were only about half the cost (4,5 guilders) of muskets (10 guilders), pike and armour (8 guilders), or greatsword and armour (11 guilders). This in turn led to Dutch infantry not faring very well in battles, as they didn't have enough pikes to provide staying power on the field.
Here are the armaments of a few selected companies from the Dutch army in 1573-1575:
| Captain | # of men | Pike | Halberd | Sword | Musket | Caliver |
|---|---|---|---|---|---|---|
| Jacques Hennebaert | 150 | 5% | 3% | 3% | 7% | 82% |
| Claes Gijsbrechts | 150 | 17% | 3% | 4% | 0% | 76% |
| Hans Cremnitz | 135 | 12% | 0.7% | 5% | 0% | 82% |
| Daniƫl van Eck | 117 | 11% | 8% | 3% | 2% | 77% |
| Hans Bouwinga | 146 | 16% | 0.7% | 3% | 3% | 78% |
In 1575 William of Orange issued an order setting a standard for the composition of companies. From then on, a company was supposed to have:
This was later adjusted to:
To make choosing the more expensive weapons more attractive a couple of measures were taken. Captains started providing their pikemen with engraved armour, to raise the status of being a pikeman. Additionally, the States General decided to raise the pay of pikemen to 125% the pay of arquebusiers.
This seems to have had some effect, as by 1587 the composition of Dutch companies looked like this:
(again, a few selected companies)
Most companies appear to be hopelessly under strength, but the percentage of soldiers using pikes and halberds is significantly higher than 10 to 15 years earlier. After these changes, the Dutch army matched the standard composition of western European armies more closely.
To get back to your question, soldiers in the Dutch army decided for themselves what weapon they would wield. They'd have to make that decision before (or when) enlisting though, as company captains had certain standards to adhere to. Soldiers tended to go for the relatively cheap caliver, but after 1575 were incentivised to pick a pike or halberd.
Source: P. Groen (ed.), De Tachtigjarige Oorlog, Van opstand naar geregelde oorlogvoering 1568-1648 (The Hague 2013)
Edit: Thanks for the gold kind sir/madam :)
Follow up/clarification question: What is a swordman in this context? Were there soldiers that relied on the sword as their primary weapon during this period?
Certainly in England during the late 16th and early to mid 17th century, it was dependent upon size and rank. All soldiers carried a sword of some kind, but very few, if any, would be swordsmen exclusively. The halberd was an officer's or nco's weapon, certainly by the 17th century, so again would be rarely carried as an individual's weapon. This leaves firearms and pikes. A pike is a heavy, unwieldy and difficult weapon to handle, so bigger, and therefore stronger men would be pike armed. Those not selected for the pike would be given a firearm.