Robert Tannahill wrote the words in 1805 and James Barr wrote the music in 1818 .
Robert Tannahill wrote the words in 1805 and James Barr composed the music in 1818 .