First appeared in Analog Science Fiction/Science Fact magazine June 1990
Copyright 1990 by Geoffrey A. Landis, all rights reserved.
It seems absurd to think that there could be such a thing as air pollution on the moon. After all, there isn't even any atmosphere on the moon.
In fact, a little bit of atmosphere does exist on the moon. Gasses get to the moon from natural causes, by most of the same mechanisms gas accumulates on the Earth or on other planets. Carbon dioxide and argon outgassed from the moon as it cooled down (maybe less than the Earth, since the Earth's hot core moves the continents around, forming volcanoes at the plate boundaries--volcanic carbon dioxide is the primary source of the oxygen in the Earth's atmosphere--but still some gas should have formed on the moon). And random comet impacts also add some gas--nitrogen, water vapor, and various junk like that--not to mention a little hydrogen and helium deposited by the solar wind.
The moon, however, keeps very little of the atmosphere it receives. Any gas it momentarily captures escapes from the surface very rapidly. As it turns out, there are two different ways for gas to escape from the moon. For the light gasses--hydrogen, helium--the lunar gravity is just not quite strong enough to hold it very long, and the gas simply leaks away from the top of the atmosphere. On the sunlit side of the moon (where the gas is hottest), hydrogen and helium typically last about fifteen minutes before boiling away.
For the heavier gasses, though--like oxygen and nitrogen--the gravitational escape lifetime in the atmosphere is thousands of years. While the moon will lose atmosphere over geological time spans, it could hold onto gas for a very long time by human scales.
For these gasses a different mechanism removes them from the lunar atmosphere. The unfiltered light of the sun ionizes the gas molecules, and the ionized molecules are then quickly swept away by electric fields associated with the solar wind. This occurs in a time span of approximately 100 days. When the atmosphere gets thick enough this mechanism stops happening--but the gas generation needed to make it "thick enough" is something like 10,000 tons/day--considerably higher than anything produced in our lunar industrial facility--at least in the next century or two.
This self-cleaning property of the lunar atmosphere (or lack-of-atmosphere) is so fast that it seems absurd to expect that the lunar vacuum could be lost by small-scale operations on the moon. However, high-vacuum and ultra-high vacuum is needed for many industrial processes, many of which we may want to do on the moon precisely because of the high-quality vacuum. For example,vacuum processes which might simpler to manufacture or use on the moon include vacuum tubes, semiconductor manufacture, solar cell manufacture, and particle accelerators.
But first, a quick digression to discuss the units used to discuss pressure. For historical reasons, gas pressure is often measured in terms of the height of a column of mercury that will exert the same amount of pressure at its base. This is because old-fashioned barometers used a tube of mercury to measure pressure. One Earth-normal atmosphere is equivalent to the pressure of a column of mercury 760 centimeters tall. Some of the first barometers were made by an Italian scientist named Torricelli, and so the pressure of one millimeter of mercury is called a torr in his honor. One torr is not very much pressure: a little over one one-thousandth of an atmosphere; far too little to even consider breathing, for example. But for processes sensitive to air, one torr is a heck of a lot of gas molecules. In the business we'd call it a "rough" vacuum (although it is a whole lot better vacuum than you'll get with your ordinary home vacuum cleaner).
Good vacuums ("vacua", to the pedant, but heck, why be formal?) are measured in numbers best expressed in exponential notation. Ten to the minus three torr--one millitorr, a tad more than a millionth of an atmosphere--is better vacuum, but still not great. Ten to the minus six is getting into what we'd call very high vacuum. Ten to the minus nine--one nanotorr, roughly a billionth of an atmosphere--now that's getting to be a decent vacuum. A nanotorr qualifies for the range of "ultra-high" vacuum.
Okay, done with that digression. I won't mention the other units vacuum is often measured in, such as pascals, millibars, microns, and so on--no need to get you confused now, right?
The existing lunar atmosphere is exceedingly tenuous: something like 100,000 molecules/cubic centimeter during the lunar night, and one to ten million molecules/cubic centimeter during the lunar day [1,2]. This corresponds to pressures from 0.001 nanotorr up to a "high" of half a nanotorr, primarily consisting of hydrogen, helium, argon, and neon at night, with the probable addition of just a hint of carbon monoxide and carbon dioxide in the daytime (they would freeze out at night, of course).
So what do we need a vacuum for? And how much do we need?
As it turns out, the reason I started thinking about this subject is that I had been doing a study about the feasabilty of making solar cells on the moon , and I started to wonder if the lunar vacuum would stay good enough to do ultrahigh vacuum semiconductor processing even after we start messing it up. (Why make solar cells on the moon? Well, silicon happens to be a good material to make solar cells out of, and is a major component of the lunar crust. And it's about fifty times easier to lift something off the surface of the moon than off the Earth. If we ever go in for space industrialization in a big way, we're going to need power, and lots of it. Putting the power-plant factory on the moon is the equivalent of putting it near a major port--and one that also happens to be abundantly supplied with natural mineral resources. Anyway--) One good low-cost way to produce low-cost solar cells is by a process called plasma-deposition of amorphous silicon. Plasma deposition typically needs a background pressure in the very high vacuum range: a thousand nanotorr, to below a hundred nanotorr for some experimental set-ups.
Many other processes for manufacturing semiconductor products also require vacuum. A high-tech process for depositing high-purity compound semiconductors is Molecular Beam Epitaxy (MBE). This process requires ultra-high vacuum. Base pressure for MBE is in the range of a tenth of a nanotorr, and even lower base pressure is needed for making some very-high quality materials--where carbon and oxygen contamination are particularly harmful.
"Vacuum" tubes have a different values for the required operating vacuum, depending on the type of tube and the lifetime, noise level, etc. required. This ranges from ten-thousand nanotorr for a magnetron tube like the one in your microwave oven, to ultra-high vacuum of a tenth of a nanotorr for high-power travelling-wave tubes.
What about the moon as a site for the next-generation high-energy supercollider? Land is cheap (and there's no problem with groundhogs burrowing and shorting electrical cables, either!); there's plenty of cheap solar energy (or there will be as soon as I build my solar cell manufacturing factory!), and cooling the superconducting magnets down to cryogenic temperatures will be not very difficult, especially if we put the supercollider at the lunar pole and run it during the polar night. Most important of all, though, the moon has lots of cheap vacuum. Intersecting storage ring accelerators require very good vacuum, since residual gas tends to scatter and defocus the beam. At a pressure of one nanotorr the beam lifetime is typically around ten hours; and operating pressures of under a hundreth of a nanotorr are required for really good beam storage and operation. An additional problem is that whenever the beam tube is vented to atmosphere (for maintanence or whatever) gas gets adsorbed onto the surfaces. When the beam line is then pumped down and turned on, the adsorbed gas is knocked off the surface by the beam, meaning that it takes days after the beam is back up before the beam quality is really up to spec.
This vacuum will be degraded by human habitation and industrial processing of materials. Unfortunately, it seems rather unlikely that maintaining the lunar vacuum will be an important priority of the occupants of a moonbase. So now let's consider where waste gas is likely to come from.
The major contribution to the lunar atmosphere from a small exploration base is exhaust gas from the transport. Assuming a specific impulse of 400 seconds (90% of the theoretical specific impulse of a hydrogen/oxygen engine), landing on the moon requires 0.8 tons of propellant per ton of landed material. I assume a 10 ton lander making one trip per month with 2 tons of supplies landed per person per month (including the personnel rotation, machinery, scientific and exploration equipment, etc.) This assumes that the lander is not refueled on the moon from lunar oxygen, and that no payload is carried from the moon.
In actuality, not all of the propellant gasses end up contributing to the lunar atmosphere. The exhaust velocity of a hydrogen/oxygen engine is 4 km/sec, nearly double the lunar escape velocity. Further, if the trajectory used is an insertion into low lunar orbit followed by a descent burn, for much of the engine burn the exhaust will not be directed toward the lunar surface. But for a rough calculation here I assume that the entire engine exhaust contributes to the atmosphere.
Another contribution to the generated atmosphere is air leakage from the living quarters. One estimate  of air leakage from an advanced long-duration habitat at atmospheric pressure is 1.2 kg of oxygen plus 4.5 kg of nitrogen per person per day. It has frequently been proposed that oxygen be locally generated. If this is done, it is unlikely that nitrogen dilution would be used, since nitrogen is nearly absent on the moon. Thus, the habitat pressure would be proportionately lower, and the leakage rate is expected to be reduced to 23% of that listed above. However, as discussed later, lunar generation of oxygen would itself be likely to be a source of leakage of waste gas.
In addition to this leakage, air will normally be lost during ingress and egress for extra-vehicular (or extra-habitat) activities ("EVA"). The amount of air lost will depend on whether the airlock is simply vented during egress, or if the lock is pumped down and the exhaust air reused. In the baseline case, I will assume that the lock is simply vented, and there is one EVA per person per day, with an airlock volume is 2 cubic meters of air at one atmosphere pressure, which is somewhat less than the habitat leakage (and, like the leakage, reduced if the base is assumed to have a pure oxygen atmosphere).
A human being generates about a kilogram of waste carbon dioxide per day. I would hope that any reasonable habitat would recycle this rather than waste it... but it's quite possible that a spacesuit might not be designed to recycle the carbon dioxide, and vent it out to the surface. If the twenty person crew averages four hours of EVA per day, that comes out to an additional hundred kilograms per month.
The increase in atmospheric pressure produced by waste gas can be calculated by multiplying the mass of gas exhausted times the gravitational acceleration of the moon and dividing by the lunar surface area. Since the exhausted gas has an average lifetime in the lunar atmosphere of 100 days, the equilibrium contribution to the atmosphere is about a thousandth of a nanotorr per ton of exhaust gas per month.
Lander exhaust results in an equilibrium pressure of 0.06 nanotorr for a 20 person base, habitat leakage in a pressure contribution of 0.004 nanotorr, airlock venting 0.0017 nanotorr, and spacesuit CO2 venting negligible.
Table 1 summarizes the contributions of the various gas sources discussed. The daytime total atmosphere is in the range of 0.07 nanotorr, comparable to the natural lunar atmosphere. (During the lunar night, some of this will be adsorbed into the soil, lowering the pressure a bit). Good: for the small base, at least, the vacuum is still okay for most anything we want to do.
If industrialization takes place on the moon, it could be expected that the lunar habitat may have hundreds of inhabitants, and considerably more frequent resupply flights. In this case, the vacuum degradation will be correspondingly worse. The baseline calculated here will be for a 250 person base processing oxygen from lunar soil.
I assume here slightly less support material required from Earth, 1 ton of material per person per month; however, since the lander is fueled from lunar-produced oxygen, the fuel for the lander must be delivered into lunar orbit. Total gas contribution to the lunar atmosphere is 720 tons/month, for a pressure contribution of 0.6 nanotorr. Habitat leakage and airlock losses will contribute 0.05 nanotorr.
Lunar oxygen production to fuel the lander will require 400 tons of oxygen per month. A 25% loss, which my guess for what might be a realistic leak rate for a low-cost industrial process, would contribute 0.13 nanotorr. If the trans-lunar injection ship is also to be fueled, this is a additional contribution. It has been proposed that lunar oxygen production could be used as a cheap source of fuel for spacecraft to be used from Earth orbit. I assume a baseline facility designed to deliver oxygen to Earth orbit at a production rate of 500 tons per month. Lifting this from the moon will require 400 tons of fuel, and leakage losses will be about 200 tons. The contribution to the lunar atmosphere is 0.78 nanotorr. This will be considerably less, however, if the oxygen is to be shipped by mass-driver rather than lifted off the surface by rocket.
The moon's soil does contain trapped gas, primarily hydrogen and helium from the solar wind, plus some carbon compounds and nitrogen. The concentration is low, something like 50 parts per million, but it is only loosely bound to the soil. Physical disturbance, as well as movement of soil by mining, etc., will likely release some of the gas content. This contribution is expected to be negligible compared to other sources.
However, we may want to use this gas. Fifty parts per million isn't much, but it seems to be the best source of hydrogen on the moon, and it's conveniently easy to recover--literally, all you have to do is shake and bake. Possibly more importantly, the helium in the soil contains a trace amount of the rare isotope helium three (3He). Helium three would make a very nice fuel for a fusion reactor--except that there is very very little 3He on Earth. Mining the lunar regolith for helium 3 to fuel terrestrial deuterium-helium 3 fusion reactors has recently gotten many people quite excited  (of course, we do first to learn how to make fusion work...). 3He implanted into the lunar regolith by the solar wind would be extracted by baking the soil, distilled, and shipped to Earth for fusion fuel. And, for every ton of 3He produced, about 3300 tons of helium 4, 6100 tons of hydrogen, 3000 tons of carbon monoxide and dioxide, and 500 tons of nitrogen will be produced. Ten tons of 3He mined per year would fuel half the US electrical consumption, and most of the byproduct gasses produced will be useful to the lunar base. Except for refrigeration and pressurization use, however, the helium produced will not be of great use, and will likely leak to the atmosphere sooner or later. Fortunately, the escape of hydrogen and helium is so fast that despite an estimated 50,000 tons of hydrogen and helium waste released to the atmosphere, the pressure contributed is trivial.
If 25% of the gas content is lost as waste due to soil agitation during mining plus leakage and waste in the baking and condensation process, our ten tons per year of 3He will produce 12,000 tons/yr of carbon dioxide and nitrogen, which results in a contribution of 0.87 nanotorr.
The moonbase is also likely to be a place where many other mining, refining and manufacturing operations take place, producing solar cells, aluminum and titanium structures, habitation modules, and many other objects useful to further industrialization and colonization. These processes will certainly result it some amount of gas generation and, consequently, wastage. But until the processes are more completely specified, the contributions from this processing will remain unknown.
The total contribution to the lunar atmosphere from the assumed industrial facility producing both oxygen and helium 3 is 2.5 nanotorr (see Table 1), a factor of 5-100 higher than the "natural" daytime atmosphere. This is low enough that manufacture of amorphous silicon solar cells can be performed without any additional vacuum pumping. For other processes I mentioned earlier, such as MBE, travelling-wave vacuum tube formation, or siting of a supercollider on the moon, the vacuum is not good enough, and these will require additional pumping.
What about the future? What happens when Luna City becomes a major node of solar-system transportation, with a population of a million industrial workers?
We can expect that as the technology gets better, the sources of gas leakage will decrease. Mass-driver based systems will undoubtably be used for outward-bound transportation except for human beings, and it is likely that some sort of tether system might be used for transport as well, of humans as well as cargo, eliminating rocket exhaust pollution almost completely. On the other hand, this will be offset to some extent by the fact that as living on the moon becomes more routine and transportation costs drop, people will begin to pay less attention about small losses, and as new mining and manufacturing capabilities come on-line, new sources of pollution will appear as well. So it's hard to predict too far in the future. As a rough estimate, perhaps we could guess that each person in Luna City will produce a quarter as much waste gas as produced per person by the 250 person industrial base. This results in our million-person Luna City having a pressure of two and a half microtorr, making for a very dirty vacuum indeed.
While the lunar vacuum may not be sufficient for some operations, it must be kept in mind that even after degradation, the ambient remains a very high vacuum. It is much easier to pump a starting ambient of one nanotorr down to ultra-high vacuum than it is to reach it from atmospheric pressure. Leaks will be little problem; there will be almost no problem with desorption of gasses from chamber walls that have been exposed to ambient, and finally, the "vacuum chambers" will not be required to hold up to the large mechanical pressure of 10 tons/ square meter imposed by the Earth's atmosphere.
It is an advantageous feature of the moon that the vacuum is self cleansing by the solar ultraviolet and solar wind. "Air pollution" is a temporary effect. If it is decided that a high vacuum is required, a wait of a few hundred days will suffice for the gas to be removed by the solar wind. However, this is only true as long as the amount of atmosphere present is low enough that there is little shielding of the solar UV. This is likely to be true for the amounts of gas discussed in the present paper. Some amount of gas will be adsorbed by the lunar soil. Cleansing of this gas to restore the original ultrahigh vacuum will take longer, since the soil will take time to outgas.
So far I've assumed that the waste gas is evenly distributed around the moon.
The immediate vicinity of intermittant gas sources, such as the exhaust plume of a lander or the area ajacent to an airlock during depressurization, will have large, but temporary, surges in the gas concentration. Such surges in pressure were seen, for example, in results from lunar atmosphere experiments on Apollo missions, where the observed pressure rose dramatically when the LM was depressurized, when an astronaut approached the apparatus  (due to exhaust gas from the astronaut's EVA suit), and on lift-off of the LM from the surface. These pressure surges were superimposed on a longer term transient due to gradual degassing of the LM. Sensitive processes would likely be shut down during such periods.
Gas molecules escape from the atmosphere primarily from the sunlit hemisphere of the moon, where they have higher kinetic energy and also are subject to photoionization by solar UV. Thus, the escape lifetime is determined by the gas distribution on the sunlit hemisphere.
For pressures of nanotorr and below, the distance travelled by a typical molecule between collisions with another molecule is hundreds to thousands of kilometers; thus, the movement of gas in the atmosphere is primarily via ballistic transport. Gas molecules leave the surface with random direction and a thermal velocity profile, follow a ballistic trajectory until again intersecting the surface, and then may be temporarily adsorbed by the surface before bounding off again at a random direction and velocity. Adsorption of gas by the surface is irrelevant to final pressure, since the adsorbed gas neither contributes to the total pressure nor is subject to escape; although a large amount of gas stored in the adsorption reservoir does increase the time needed to reach equilibrium pressure as well as the time needed to purge the atmosphere after the gas source is discontinued.
At the daytime surface temperature of 365° K, the average vertical and radial velocities are 300 and 430 m/sec respectively for a typical molecule (here assumed to be O2). The distance this typical molecule travels on an average "hop" is 160 km, spending 380 seconds in flight before bouncing off the surface.
In a random walk process the average distance travelled equals the distance d per step times the square root of the number of steps (just take my word for it, okay?), so to cover the surface area of the moon thus requires 450 steps, and a total flight time of 47 hours. This time is short enough compared to the escape lifetime of gas in the atmosphere that the assumption of roughly uniform gas distribution is justified, and there is little difference in the amount of gas near the base and far from the base.
Hydrogen and helium, though, being considerably lighter, spread across the full surface area of the moon much much faster--in fact, in just about an hour. Since the escape time for hydrogen and helium is much less than an hour, gas concentrations for hydrogen and helium are not uniform, and considerable variations in density will exist between areas close to the gas source to areas far away.
On the night side of the moon, where the temperature is considerably cooler, molecules take six times as long to diffuse across the same area. Since any given molecule will spend six times as long on the night hemisphere as on the day hemisphere, the gas reservoir on the night side will be proportionately greater.
Establishment of a large lunar base will indeed pollute the lunar vacuum. The time scale for distribution of exhaust gas across the surface of the moon is much less than the excape lifetime of the gas in the lunar atmosphere, and thus exhaust gas end up uniformly spread across the surface. A 20 person exploration base will contribute negligible pollution, but a 250 person "industrial" facility could degrade the lunar ambient to levels on the order of 3 nanotorr, replacing the mostly non-reactive gasses hydrogen, helium, and neon with more reactive gasses containing carbon and oxygen. This vacuum is still good enough to perform some vacuum processes, such as making amorphous silicon solar cells, but other processes will now require pumping down to a good vacuum. Establishment of "Luna City" would inevitably degrade the lunar vacuum much more.
As a concluding speculation, so far I've been assuming that an atmosphere on the moon is bad. But, if we think far enough into the future, wouldn't an atmosphere on the moon be good? Can we put so much gas into the atmosphere of the moon that it could become breathable, to turn the formerly lifeless moon into our nearest habitable world in space?
That's a lot of atmosphere needed. About the minimum you could expect a human to be able to breath is one PSI of pure oxygen, which is about 50 torr--twenty million times the "pollution" level of "Luna City".
Could we manufacture the oxygen? We would need something like two hundred trillion tons. The chemical composition of lunar rock is about half oxygen; all we have to do is reduce the amount of rock equivalent to a cube about fifty kilometers on an edge. That's a lot of rock. On the other hand, it's a small volume compared to the size of the moon. Such a chunk of rock reduced to oxygen would give the moon an atmosphere that would last three thousand years--longer than any civilization on Earth has ever lasted, and when it leaks away, we could keep replacing it every few thousand years for a long, long time before we even begin to use up the moon.
But the amount of energy needed to turn half a quadrillion tons of rock into oxygen is mind numbing! Even fusion energy wouldn't be enough--we'd pretty much require some way of making direct conversion of matter to energy. And if we can do that, minor projects like terraforming the moon become trivial.
Alternatively, if we could find an icecube fifty kilometers on an edge and crash it into the moon, the moon would acquire an atmosphere of water vapor. That, as it happens, is just fine--in a relatively short time (well, "short" might mean as much as hundreds of years) ultraviolet from the sun will split off the hydrogen, which leaks away, leaving atomic oxygen, which will quickly combine to form ordinary O2--just what we need to breath.
A comet pretty much fits the description of a floating ice cube (or at least a snowball). Unfortunately, 50 kilometers across is quite a large comet. Comet Halley, for example, the only one we've ever gotten a good close look at, has a nucleus only 16 kilometers across--it would take fifty to a hundred comets this size to do the job, even assuming that the water doesn't splash away when the comets hit the moon!
But there are plenty of comets out in the Oort cloud. And some of them might very well be big compared to Halley. For example, consider the object called Chiron, that circles around somewhere outside the orbit of Saturn. Chiron was once thought to be a large asteroid but is now known to be a comet, or at least a comet-like object (it has a cometary halo). And Chiron is almost two hundred kilometers across. Plenty of ice to split off a chunk give the moon an atmosphere, and save lots for later.
Leaving plenty of problems to be solved for later. Like, just how do you propel a comet, anyway? Would anybody sane ever let you do it? (Keep in mind that if you should miscalculate and hit the Earth by mistake, you'd make "nuclear winter" look like a warm spring afternoon). What do you do with the inhabitants of Luna City when the comet hits? And just how do you expect renew the atmosphere after a few thousand years, when there is a thriving civilization on the moon that would just as soon not get hit by a comet?
All these are problems for the next millennium. For now, it would be a start just to get the moonbase up and running.
But it doesn't hurt to dream....
*Some people might want to quibble about my characterizing hydrogen as a "mostly nonreactive" gas, since here on Earth it's manifestly very reactive (with air, anyway). Since my main interest is semiconductor manufacturing, where hydrogen contamination is harmless or even beneficial, that's partly my personal bias. However, on the moon, with no free oxygen and a scarcity of oxidizing agents of any sort, there isn't much around for hydrogen to react with.
Most of the results here are taken from the author's article "Degradation of the Lunar Vacuum by a Moon Base" (Acta Astronautica,Vol. 21 , No. 3, 183-187 (1990).See: Degradation of the Lunar Vacuum by a Moon Base
 R.R. Vondrak, "Creation of an Artificial Lunar Atmosphere," Nature, Volume 248, pp. 657-659 (1974).
 J.H. Hoffman et al., "Lunar Atmospheric Composition Results from Apollo 17," Proc. 4th Lunar Sci. Conf, pp. 2865-2875, 1973.
 G.A. Landis and M.A. Perino, "Lunar Production of Solar Cells: a Near-Term Product for a Lunar Industrial Facility," in the AIAA volume Space Manufacturing 7 (1989).see: Lunar Production of Solar Cells
 P.O. Quattrane, "Extended Mission Life Support Systems", in Vol. 57, Science and Technology Series, The Case for Mars, P.J. Boston, ed., pp. 131-162 (AAS, 1984).
 G.L. Kulcinski and H.H. Schmitt, "The Moon: an Abundant Source of Clean and Safe Fusion Fuel for the 21st Century," Lunar Helium-3 Fusion Power Workshop, NASA Lewis Research Center, April 25-26 1988.
 F.S. Johnson et al., "Cold Cathode Gage (Lunar Atmosphere Detector)", in Apollo 12 Preliminary Science Report, NASA SP-235, p. 93 (1970).
 F.S. Johnson, "Lunar Atmosphere," Rev. Geophys. and Space Phys., Vol. 9 #3, pp. 813-823 (1971).
 J.O. Burns et al., "Artificially Generated Atmosphere Near a Lunar Base," Proceedings of the Lunar Bases and Space Activities in the 21st Century Symposium, Houston TX, April 5-7, 1988.
Source Contribution (nanotorr) Notes
20 Person Base:
Propellant 0.06 50 ton lander; all exhaust gas contributes
Habitat Leakage 0.004 6.7 Kg/person/day
Airlock losses 0.002 2 m3 vented; less if pumped down for EVA
Total 0.07 nanotorr
250 Person Industrial Facility:
Propellant 0.6 refueled using lunar oxygen
Habitat Leakage 0.05 6.7Kg/person/day
O2 Production 0.9 500 tons produced month; 25% leakage
3He Mining 0.9 10 tons produced per year; 25% leakage
Industrial Processing unknown
Total 2.5 nanotorr