Why is there a constant in the ideal gas law?
Solution 1
Constants in physics are not just unit matching things. They are actually very fundamental. Yes, it is an heuristic and easy way to explain constants as unit keepers and I have nothing against that; but constants represent a sort of privileged group in nature. They are like symmetry points were everything moving around most do so in a way to keep their values the same.
Now for gas constant ($R$): it is an experimental constant.
Imagine that you have a thermos bottle filled with a gas having a piston at its top which you can pull/push, an electric resistance inside that you can use to heat the gas, a thermometer and a barometer. The thermometer and the barometer are placed in such a way they can give the temperature and the pressure of the gas inside the bottle.
At a certain moment you make a measurement of all these three parameters $p, V$ and $T$. Let’s say you get the values $p_0, V_0, T_0$. Now do any of the following:
Heat up the gas or pull/push the piston up/down. You can do all of that at once. After that perform a new measurement of the above parameters. Let’s say you get $p_1, V_1, T_1$.
You will realize that no matter what you do, in an isolated system, the values of the parameters $p, V$ and $T$ will always change in such a way that the ratio between the product $pV$ by $T$ is constant, i.e.,
$$φ=\frac{p_0 V_0}{T_0}=\frac{p_1 V_1}{T_1}=\frac{pV}{T}=constant \tag{1}$$
This means that, once you make an initial measurement and get a value for $φ$, in the future you’ll be required to measure just 2 of the parameters, and the third will be established using an equation of the form $$pV=φT \tag{2}$$
The problem is, you cannot make any assumption about the general validity of equation (2). By this time, it is just and ad hoc equation which serves the purpose of your current setup or experiment. What if you increase/reduce the amount of gas inside the bottle? Or you change the gas type?
In the case of increasing/reducing the amount of gas inside, just as expected, the value of $φ$ will increase/reduce by the same proportion $n$ as the amount of gas added/removed. Or
$$φ =\frac{pV}{T}= nφ_0 \tag{3}$$
where $φ_0$ is the value of $φ$ for a unit amount of gas.
The big leap here is a discovery by Amadeo Avogadro known as Avogadro’s law, which in other words, says that, if one uses the amount of substance $n$ in terms of the number of moles instead of $\mathrm{kg}$ or $\mathrm{lbs}$, then, under the same conditions of $p$ and $T$ all gases occupy the same volume, i.e., the values of the $φ$’s are the same. He discovered that, for 1 mole of any gas under $1 \, \mathrm{atm}=101.325•10^5 \, \mathrm{ \frac{N}{m^2}}$ and $0 \, \mathrm{°C}= 273.15 \, \mathrm{K}$ the gas occupy $V_0=22.4•10^{3} \, \mathrm{m^3}$.
Now we can generate an universal value for $φ_0$ as
$$φ_0=R=\frac{p_0 V_0}{T_0}=\frac{101.325 •10^5×22.4•10^{3} \, \mathrm{\frac{N}{m^2}×m^3}}{273.15 \, \mathrm{K}}=8.3 \, \mathrm{J/K} \tag{4}$$
Now (2) can be written as
$$pV=nRT \tag{5}$$
and if we do so, we get a compact and universal form to describe the thermodynamic system.
But there is more in (5) then just a compact form of describing the thermodynamics system. As you can see in (4) the units of $pV$ turns out to be $J$. It actually represents total work done by an isolated thermodynamic system. Deriving (3) for the same amount of substance, we get
$$p \mathrm{d} V+V \mathrm{d} p=nR \mathrm{d}T \tag{6}$$
$p \mathrm{d} V$ is the so called expanding reversible work and $V \mathrm{d} p$ is the so called shaft work. Since in the right side of (4) the only variable is $T$ it gives a new meaning for temperature as some form of energy (or energy potential) of some sort, and we can understand heat as energy and not some kind of substance as it was thought in past.
Solution 2
Constants are used to convert between quantities of different dimensions.
Take the case of $I(t) = I_0\sin(\omega t)$, for example. The argument of the $\sin$function must be dimensionless. Therefore, if $t$ has dimensions of time, we need to multiply it by a constant with dimensions of inverse time so that the argument is dimensionless. Thus $\omega$ is defined such that $\omega t$ is dimensionless. Similarly, if $I(t)$ has dimensions of current, we need another constant, $I_0$ to make the right hand side also have dimensions of current. Moreover, if the amplitude of the current is, say, 5 Amps, we express that in the constant $I_0$.
In the case of the ideal gas law we want $P$, $V$, and $T$ to have different dimensions. The constant $R$ (or $k_B$), scales and relate the dimensions on the right hand side with the dimensions on the left hand side: namely temperature to pressure (force per area).
Note that for the case of the ideal gas law, it would be perfectly okay to write $PV = NT$; you would just have to understand that $T$ now means something different, i.e. temperature would have dimensions of energy, which is perfectly reasonable as described in this other post.
Related videos on Youtube
Shawn O'Brien
University Student with a large passion for physics and a curious enough mind to try and learn concepts that are far beyond my abilities in mathematics and my mental capacity at the moment. Completely fascinated with all things Quantum and all things Cosmic.
Updated on April 18, 2020Comments

Shawn O'Brien over 2 years
Why do we have constants?
Consider, for example, the ideal gas law,
$$PV = nRT \, . \tag{ideal gas law}$$
Sometimes I believe that the constant is there in order to make the equation work (make the units line up per se), but other times I feel like such assumptions are unnecessary.
I don't entirely understand why that constant is used, besides the fact that it is necessary for the units.
NB/ This is not intended to stir philosophical debate. I am purely curious of the nature of constants in cases such as $R$ (not $c$ as I understand that the speed of light is uniformly constantly) I am simply asking whether these constants are necessary for our equations and understandings or if they are universally constant.

DanielSank over 4 yearsThis is a good question, and has essentially already been asked here: Is the Boltzmann constant really that important?. Note that the ideal gas law can be written $PV = N k_b T$ where $N$ is the number of particles and $k_b$ is Boltzmann's constant. In other words, $R$ and $k_b$ contain the same information, just rearranged.

Shawn O'Brien over 4 yearsbut since the thermodynamic relation between energy and temperature is fixed, how can we determine if such constant is true?

DanielSank over 4 years@ShawnO'Brien Boltzmann's constant (or the gas constant) is just an arbitrary conversion between energy and temperature. One way to look at it is that energy is a "real" dimension whereas temperature is "made up" as explained in the question linked in my above comment. That being the case, the value of $k_b$ (or $R$) is in principle completely arbitrary. Of course, historically, the temperature scale (in Kelvin, for example) was defined independent of energy scales, and so that value of $k_b$ in a particular system of units was fixed by that choice and the choice of energy unit (e.g. Joule).

DanielSank over 4 yearsDo not make the common mistake of confusing units and dimensions. Dimensions are things like "energy", "time", and "charge", while units are things like "Joule", "second", and "Coulomb".

Hagen von Eitzen over 4 yearsNote that there'd be even a second constant $T_0$ to be introduced, $pV=nR(TT_0)$ if one used Celsius or Fahrenheit for temperature, i.e., while $R$ is introduced for the "stupidity" of considering temperature as something else than energy, $T_0$ is introduced for the second "stupidity" of picking an arbitrary scale based e.g. on weid properties of melting ice.


DanielSank over 4 years"Constants are used to express the units with which you are working." No, they're not. Constants exist regardless of the unit system. There is one case where constants change depending on the system of "dimensions", e.g. with the CGS vs. SI versions of electrodynamics. Note that in CGS, what is called "charge" is not the same thing that is called "charge" in the SI system.

DanielSank over 4 yearsThis answer contained what I believed to be several errors all related to confusion about the difference between units and dimensions. I have heavily edited the answer to make it correct. Please note that you can rollback the edit if you want, although I would encourage careful examination of the edited version first.

njspeer over 4 yearsI was using the term 'units' to refer to both scale and dimensionality, which is a common way to speak. In some cases, constants relate quantities of the same dimension. E.g. 1 minute = 60 seconds. In other cases, they relate variables of different dimensions. With your edit, I don't think the first bullet is true anymore. Anyway, the point I was trying to make is that you can set any constant equal to one, you just run the risk of changing the meaning of the variables (and possibly their dimensionality), as in your example of CGS (units), or setting variables such as $\hbar$ or $c$ to one.

DanielSank over 4 yearsUsing "unit" to refer to dimensionality may be somewhat common, but it's confusing enough for me to call it "wrong". I do not understand the relevance of the 1 minute = 60 seconds other than to point out that point #1 is now erroneously ignores the case of dimensionless constants. That can be fixed with a small edit.

DanielSank over 4 yearsThis is a good historical view. Note, however, that the value of $R$ in any particular unit system is tied intimately to the fact that the temperature scales were defined arbitrarily.

Nat over 4 yearsJust as a formatting note, I'd recommend against using
\rm
for variables, though it's entirely appropriate for units and stuff like the derivative operator (e.g., ${\mathrm{d}}T$ would be best, where the variable is italic while the operator isn't). $\rm\TeX$ is italic by default since variables tend to rule equations. 
njspeer over 4 yearsThe term ‘unit’ implies both. Take, fore example, the case of natural units, where the term ‘unit’ refers to both scale and dimensionality. I don’t think it’s confusing or wrong—it’s just one of the many ways the word is used in normal language. The example you mentioned, CGS units, is another good example of a case where the term ‘unit’ refers to a both scale and dimensionality.

DanielSank over 4 yearsNote that both "natural units" and "CGS units" are two of the most common points of confusion for physics students. Given their role in generating confusion, I do not see those examples as good arguments in favor of using "units" to mean "dimensions".

njspeer over 4 yearsAgain: units don't mean dimension—no one said that. Units imply dimension. If I tell someone a variable has units of 'seconds,' is there any confusion over the dimensionality? No. This is why everyone uses the two terms interchangeably. I've never met anyone who had the confusion you speak of. And the examples I gave are beautiful because they illustrate the connection between units and dimension. In fact, natural units were what I had in mind when I stated that you can set $k\equiv 1$. I can do that with no loss of generality precisely because I can redefine the dimensions of $T.$

DanielSank over 4 years"I've never met anyone who had the confusion you speak of." Go to an undergraduate E&M course and ask if anyone understands the difference between SI and CGS :) I agree with the statement that units imply dimensions. Note, however, that "natural units" is a misnomer, because natural units is not a choice of units. You can work in "natural units" whether you like seconds, minutes, years, or whatever else. The crucial difference is that in "natural units", we don't work with distance, but rather work only with times. In other words, we redefine $x$ to be $x/c$.

DanielSank over 4 yearsIn other words, "natural units" is actually a choice only of dimensions. This is pretty obviously an indefensible abuse of language.

DanielSank over 4 years"Constants in physics are not just unit matching things. They are actually very fundamental." While that may be true, the gas constant isn't a very good example of a fundamental constant because its existence has to do with a historical accident wherein energy and temperature were regarded as different quantities.

J. Manuel over 4 years@DanielSank But it still a mistake confusing temperature and energy. Temperature is not energy.

DanielSank over 4 years@J.Manuel that really depends on your point of view. It is completely reasonable to define a quantity $\tilde{T} = k_b T$ and call that "temperature".

WaterMolecule over 2 years#4 is the correct answer. The linked post is lovely.