Hi Carolyn,
This is quite a confusing one. I will try to lay it out best as possible though.

Edward Swan was born 9th August 1815 in Edinburgh, son of Edward Swan and Elizabeth Maxwell. This is a submitted entry on the IGI, so it would need to be confirmed by the OPRs at SP. Edward appears with parents in the 1841 census at South Leith:
Address: Kirkgate, South Leith, MidlothianEdward Swan, m, 50, tailor (journeyman), b. outside county
Elizabeth Swan, f, 50, milliner, b. outside county
Edward Swan, m, 20, coach builder (journeyman), b. in county
According to birth certificate of the unnamed daughter Swan born 1863, Edward Swan and Janet McLaren married 1845 in Edinburgh (no exact date given).
In 1851, I cannot see the family. However, there is an Edward Smith, joiner, aged 33 lodging in Edinburgh with an Alexander Smith, aged 6.

Maybe someone else can take a look? Edward's parents are staying at Tolbooth Wynd, South Leith in 1851. Two grandchildren; Edward, a scholar, aged 7 and Jane, aged 2.
In 1861, we have the family above. Edward's parents are still living in 1861, at North Gray's Close, Edinburgh. The two grandchildren are staying with them; Edward, 17, who now works as a dic & staurp?? cutter and Jane, 13.
I believe Janet Swan m.s. McLaren died October 8th 1868 in the St Cuthberts' Poorhouse.

She is described as the wife of Edward Swan, pauper and she was 38. No parents' names and the death was registered by a poorhouse official, I think.
Edward Swan died December 12th 1868 in the Poorhouse; although confusingly, he is listed as the widower of Elizabeth Begbie.

He was 54 and his parents are as above, both deceased. Death was registered by his son, Edward Swan.
However, where does the name change come from? I don't easily see Robert in 1871 to question where he went after the death of his parents.
hume