I am using R and I have two data frames: carrots and cucumbers. Each data frame has a single numeric column that lists the length of all measured carrots (total: 100k carrots) and cucumbers (total: 50k cucumbers).
I wish to plot two histograms—carrot length and cucumbers lengths—on the same plot. They overlap, so I guess I also need some transparency. I also need to use relative frequencies not absolute numbers since the number of instances in each group is different.
Something like this would be nice, but how can I create it from my two tables?

That image you linked to was for density curves, not histograms.
If you’ve been reading on ggplot then maybe the only thing you’re missing is combining your two data frames into one long one.
So, let’s start with something like what you have, two separate sets of data and combine them.
After that, which is unnecessary if your data is in long format already, you only need one line to make your plot.
Now, if you really did want histograms the following will work. Note that you must change position from the default "stack" argument. You might miss that if you don’t really have an idea of what your data should look like. A higher alpha looks better there. Also note that I made it density histograms. It’s easy to remove the
y = ..density..to get it back to counts.On additional thing, I commented on Dirk’s question that all of the arguments could simply be in the
histcommand. I was asked how that could be done. What follows produces exactly Dirk’s figure.