Skip to content
Prev 383376 / 398502 Next

Subtracting Data Frame With a Different Number of Rows

Hi Phillip,

You have two choices here: 1. Manually enter the missing rows into
your individual.df using rbind(), and cbind() the overall.df and
individual.df dataframes together (assuming the rows line up
properly), or 2. Use merge() to perform an SQL-like "Left Join", and
copy values from the "overall" columns to fill in missing values in
the "indiv" columns (imputation). Below is code starting from a .tsv
files showing the second (merge) method. Note: I've only included the
first 4 rows of data after the merge command (there are 24 rows
total):
RunnerCode Outs X.x MeanRuns.x X.y MeanRuns.y
1       BasesEmpty    0   1  0.5137615   1  0.4262295
2       BasesEmpty    1   9  0.3963801   8  0.5238095
3       BasesEmpty    2  17  0.4191011  15  0.3469388
4      BasesLoaded    0   8  3.2173913  NA         NA


HTH, Bill.

W. Michels, Ph.D.
On Tue, Apr 21, 2020 at 1:47 PM Phillip Heinrich <herd_dog at cox.net> wrote: