synth-inference / synthdid

Synthetic difference in differences
https://synth-inference.github.io/synthdid
BSD 3-Clause "New" or "Revised" License
262 stars 98 forks source link

Extracting data behind plot #105

Open ThijsBusschots opened 1 year ago

ThijsBusschots commented 1 year ago

Dear,

The command plot(tau.hat) shows a great summary of the estimate in a plot. I would like to access the data behind the plot, so I can export it as a dataframe. However, I cannot seem to find a way to do that. Is there a way to get the results depicted in the plot in a dataframe? With per year:

The reason I want to extract the data from the plot to a dataframe, is because I have to export the data to another environment where I make the plot.

Kind regards

davidahirshberg commented 1 year ago

Take a look at the code in the function synthdid_plot.

tahokovi commented 11 months ago

Since the object produced by the plot function is a ggplot object, you can run ggplot_build(your_figure_here)$data[[1]] to extract the data behind the SDID plot.