added write_att overload for R