I make several new columns from the existing column, the total variable A, the total variable B, the different price A, the different price B. Because I am the newest beginner, I make it step by step, one by one. But then, the new columns didn't appear in the data frame. And make it difficult to make a histogram. mention as error causes the column not exist. in addition, there are also some NA in my data.
drop_na(df)
add_column(df, "total.A", .before = NULL, .after = NULL)
mutate(df, "total.A" = outcome.2017 + outcome.2018)
add_column(df, mutate(diff.outcome.A= outcome.A.2017 - outcome.A.2018), .before = NULL, .after = NULL)
mutate(df, diff.outcome.A = outcome.A.2017 - outcome.A.2018)
Then I have to make histograms of the total (1 histogram) and difference (1 histogram), according to the sex (variable gender, male 1 female 2). Then everything has gone error all the time. Thank you for all the advice.