In the 1870 census, she appears to be be Sarah Whitford, age 38 NY, a nurse in New York City. In the household are two children, Stephen & Ada Whitford, ages 9 & 6. Perhaps she and Stephen have separated or divorced, or he has died.
In the 1880 census she is Sarah Farmer, 45, married to George Farmer, 35, and living in Brooklyn, NY. In the household are the following children: Charles W. Farmer 11, Anna M. Farmer 10, Stephen W. Whitford 18, & Addie E. Whitford 16. According to census data, Stephen & Addie were born in Brooklyn, NY; their father was born in RI and their mother in NY.
I think Charles & Anna belong to George from a previous marriage.