He was born in Cupar, Fife, Scotland, the son of the Rev. Peter Barclay DD & Margaret Duddingston, sister of William Duddingston RN. The latter encouraged Robert's naval career. He entered the Royal Navy in 1798, aged 11. In 1805 he was promoted Lieutenant, and took part in the Battle of Trafalgar aboard. He was subsequently appointed the Second Lieutenant of the frigate, serving in the English Channel. In November 1809 he lost his left arm while leading a boarding attack on a French convoy. After recovering, he continued to serve as lieutenant aboard several ships and smaller craft on the North American station. After war with America broke out, the Commander in Chief on the North American station, detached Barclay and two other lieutenants to act as "Captains of Corvettes" on the Great Lakes. Barclay arrived at Kingston on Lake Ontario on 5 May 1813, and took charge of the squadron there with the acting rank of Commander. Ten days later he was superseded by Captain James Lucas Yeo. Yeo first offered the command of the detached squadron on Lake Erie to his friend, William Mulcaster. Mulcaster declined, probably because of the undermanned and underequipped state of the force, and the post was offered to Barclay, who quickly accepted. The Americans dominated Lake Ontario and held the Niagara Peninsula. As a result, Barclay was forced to travel overland to Amherstburg, where his command was based, with a handful of officers and seamen. He arrived there on 5 June. Although the Americans had no armed vessels on the lake, they were constructing two large brig-rigged corvettes at Presqu'Isle, and also transferring several from Black Rock on the Niagara River. Barclay immediately set sail in two of his armed vessels. He first reconnoitred Presqu'Isle, and determined that it was defended by an entrenched force of 2000 militia, and the two American brigs had their lower masts fitted. He then proceeded to intercept the American ships from Black Rock, but missed them in hazy weather, although at one point the two forces were apparently only fourteen miles apart off the Cattaraugus Creek. For the next few weeks, Barclay maintained a blockade of Presqu'Isle, preventing the Americans under Oliver Hazard Perry from crossing the sandbar at the mouth of the harbour. He meanwhile repeatedly requested that Yeo send him more sailors and arms, and that the Lieutenant Governor of Upper Canada reinforce the troops at Amherstburg under Major General Henry Procter. Neither senior officer sent the requested help. On 28 July, bad weather and shortage of supplies forced Barclay to lift the blockade. When he returned three days later, Perry's force was free of the sandbar and apparently ready for action. Barclay reasoned that he was outnumbered and withdrew. From then on, Perry controlled the lake, and the British were unable to move supplies to Amherstburg. Finally in September, Barclay had received a last reinforcement of a few officers and sailors and part completed a ship-rigged corvette, but no food remained at Amherstburg. Barclay set out to fight Perry's squadron, and in the Battle of Lake Erie his squadron was defeated and captured by the Americans. Barclay himself was severely wounded in his right arm. As was customary after any defeat or the loss of any ship, Barclay was court-martialed. He appeared before the court with one leg and his surviving arm swathed in bandages. The court exonerated him, stating "the Judgement and Gallantry of Captain Barclay... were highly conspicuous and entitled him to the highest Praise". His promotion to Commander was confirmed in November that year. In August 1815, he married his first cousin, Agnes Cosser, at St John's, Smith Square, London and they had several children. In November of that year he was granted an annual pension of £200. Barclay later petitioned the Admiralty for employment, but received the command only of a bomb vessel in 1822. From 1824 to his death in Edinburgh in 1837, he saw no further service.