Its hard to help you with data and code we can't see.
In general when trying example code; its best to run their entire lesson on their data, and try to understand their steps; where your data/issues may differ, so that you can a) be confident that they example code at least works on their data... b) have more knowledge when adapting theirs to yours.
I can tell you that * R: propensity score matching is available as part of the MatchIt
,[7][8] optmatch
,[9] or other packages.
I would really encourage you to review the following guide, FAQ: Tips for writing R-related questions.
For example, the guide emphasizes asking coding questions with formatted code-chunks and a reprex
.
You may have noticed folks here requesting minimal reprex
es, that's because asking questions this way saves answerers a lot of time.
Reproducible Examples:
- help make your question clear and replicable
- increases the probability folks will reach out and try to help,
- reduces the number of back-and-forths required to understand the question,
- and makes your question and suggested solutions more useful to folks in the future researching similar problems.