I'm very new to R and I have to deal with quite big datasets from a previous work. During these previous studies, the person worked on excel and I have to adapt everything on R.
Especially, I did 2 simple linear regressions. To simplify, the first one represents Y as a function of X from one dataframe, let's call it My_Data_1, and the second one is Y' as a function of X, with Y' a variable in the dataframe My_Data_2. In other words, X,Y and Y' come from different dataframes (among many other variables).
I'd like to compare the two regressions by plotting them on a single graph using ggplot2.
However, I don't know how to procede because the dataframe import is done in the ggplot, such as: ggplot(data = My_Data_1, aes(x=X, y=Y)) + geom_point() + etc...
I tried to put only x in the ggplot() and to put Y and Y' in geom_point() but it doesn't solve anything: Y' is unknown in this case because only one dataframe is imported in ggplot. I didn't find solution. One would be to create a new table but I'd like to know if there is another way to do so.
I hope it was clear enough... Thanks by advance for your help!