Tail wags don't just mean one thing. According to BBC on Oct. 31, the wag of a tail can mean a dog is happy, or anxious. The difference, is that when a dog wag's their tail to their right, it indicates a happy wag, while a leftward tail wag means he's feeling anxious or nervous.
Neuroscientist Professor Georgrio Vallortigara notes that very similar to the human brain, the canine brain is divided and each side controls a different set of emotions. The LA Times notes that for dogs, the right side of the brain is associated with negative responses and the desire to flee from danger and the left side of the brain is associated with positive reactions.
Scientists say that other dogs are able to pick up on these differences. To determine this, dogs were shown videos of other dogs and their reactions were gauged. A dog wagging his tail to the right with no other expression elicited no reaction from the observing dog. However a dog whose tail takes a sharp turn to the left will cause the observing dog to have a raised heart rate and demonstrate anxiousness.
However he doesn't believe dogs are intentionally communicating with each other. His suggestion is that if a dog sees an anxious dog wag his tail mostly left, he'll associate that his experience with future leftward tail-waggers.