In case I'm not just missing an obvious pre-existing solution, it would be nice to be able to specify how resulting columns from pivot_wider will be ordered. Using the us_rent_income example,
us_rent_income %>%
pivot_wider(names_from = variable, values_from = c(estimate, moe))
produces the columns, estimate_income, estimate_rent, moe_income, and moe_rent. In my use-case (getting to a double-header table), I want them to be in the order, estimate_income, moe_income, estimate_rent, and moe_rent.
In case I'm not just missing an obvious pre-existing solution, it would be nice to be able to specify how resulting columns from
pivot_widerwill be ordered. Using theus_rent_incomeexample,produces the columns,
estimate_income,estimate_rent,moe_income, andmoe_rent. In my use-case (getting to a double-header table), I want them to be in the order,estimate_income,moe_income,estimate_rent, andmoe_rent.