To have x0, ..., x4 refer to the generators of R, replace your second and third lines by
R.inject_variables()