Displaying 2 results from an estimated 2 matches for "av20".
Did you mean:
a20
2024 Jun 08
1
Can't compute row means of two columns of a dataframe.
Use apply(), not by().
xxxz$av20 <- apply(xxxz[,c("Low20","High20")],1, mean)
-- Bert
On Sat, Jun 8, 2024 at 10:38?AM Sorkin, John <jsorkin at som.umaryland.edu>
wrote:
> I have a data frame with three columns, TotalInches, Low20, High20. For
> each row of the dataset, I am trying to compute t...
2024 Jun 08
3
Can't compute row means of two columns of a dataframe.
I have a data frame with three columns, TotalInches, Low20, High20. For each row of the dataset, I am trying to compute the mean of Low20 and High20.
xxxz <- structure(list(TotalInches =
c(58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76), Low20 = c(84, 87,
90, 93, 96, 99, 102, 106, 109, 112, 116, 119, 122,