Wallowing in animals
Wallowing in animals is a comfort behaviour during which an animal rolls its body about in mud, water or snow.  Some definitions include rolling about in dust, however, in ethology this is usually referred to as dust bathing.  Wallowing is often combined with other behaviours to fulfil its purpose; for example, elephants will often blow dirt over themselves after wallowing to create a thicker "coating", or pigs will allow the mud to dry before rubbing themselves on a tree or rock to remove ectoparasites stuck in the mud.

Functions

Many functions of wallowing have been proposed although not all have been tested by rigorous scientific investigation. Proposed functions include:

Thermoregulation - domestic pigs (Sus scrofa), great Indian rhinoceros (Rhinoceros unicornis), warthogs (Phacochoerus aethiopicus), elephants (family Elephantidae)
Providing a sunscreen - pigs, warthogs, elephants
Male-male conflict social behaviour - wapiti (Cervus elaphus), European bison (Bison bonasus), deer
Removal of ectoparasites - white rhinoceros (Ceratotherium simum), American bison (Bison bison), warthog
Social cohesion - American bison
Relief from moulting - European bison, elephant seals (genus Mirounga)
Relief from biting insects - tamaraw (Bubalus mindorensis), American bison, tapirs (Tapirus bairdii), warthog, elephants
Play in young animals - American bison
Skin maintenance (preventing dehydration) - hippopotamus (Hippopotamus amphibius)   
Camouflage - warthog
Scent-marking - Some animals urinate in a wallow before entering and rolling in it, presumably as a form of scent-marking behaviour

Domestic pigs

Pigs lack functional sweat glands and are almost incapable of panting. To thermoregulate, they rely on wallowing in water or mud to cool the body. Adult pigs under natural or free-range conditions can often be seen to wallow when air temperature exceeds 20 °C. Mud is the preferred substrate; after wallowing, the wet mud provides a cooling, and probably protecting, layer on the body. When pigs enter a wallow, they normally dig and root in the mud before entering with the fore-body first. They then wriggle the body back and forth, and rub their faces in the mud so all of the body surface is covered. Before they leave the wallow, they often shake their heads and body, often finishing with rubbing against a tree or a stone next to the wallow. When indoors and hot, domestic pigs often attempt to wallow on wet floor surfaces and in the dunging areas.

Although temperature regulation seems to be the main motivation for wallowing in pigs, they will still wallow in colder weather. While many have suggested that pigs wallow in mud because of a lack of sweat glands, pigs and other wallowing animals may have not evolved functional sweat glands because wallowing was a part of their behavioural repertoire.

Pigs are genetically related to animals such as hippopotamus and whales. It has been argued that wallowing behaviour and the desire to be in shallow, murky water could have been a step to the evolution of whales and other marine mammals from land-dwelling mammals.

Sumatran rhinoceros

The Sumatran rhino (Dicerorhinus Sumatrensis) spends a large part of its day wallowing. When mud holes are unavailable, the rhino will deepen puddles with its feet and horns. One 20-month study of wallowing behaviour found they will visit no more than three wallows at any given time. After two to 12 weeks using a particular wallow, the rhino will abandon it. Typically, the rhino will wallow around midday for two to three hours at a time before foraging for food. Although in zoos the Sumatran rhino has been observed wallowing less than 45 minutes a day, the study of wild animals found 80–300 minutes per day spent in wallows.  Captive individuals deprived of adequate wallowing have quickly developed broken and inflamed skins, suppurations, eye problems, inflamed nails, hair loss and have eventually died.

Deer

Many deer perform wallowing, creating wallow sites in wet depressions in the ground, eventually forming quite large sites (2–3 m across and up to 1 m deep).  However, it has been claimed that only some species of deer wallow; red deer (Cervus elaphus) particularly like to wallow but fallow deer (Dama dama), for example, do not wallow. Even within the red deer species, there is variation between sub-species and breeds in wallowing behaviour. For example, although wapiti do wallow, they and crossbreds are less inclined to wallow than European red deer.