0

I want to create a separate column for the mean value for all cells before the column. The data frame i am working on is large and the Following is a smaller version.

structure(list(Name = c("A", "B", "C"), `2005` = c(1, 2, 3), 
    `2006` = c(4, 56, 7)), row.names = c(NA, -3L), class = c("tbl_df", 
"tbl", "data.frame"))

I want it to appear the following way where the mean is of 2005 and 2006.

Name 2005 2006 Mean
A 1 4 2.5
B 2 56 29
C 3 7 5
AK1234
  • 13
  • 2

0 Answers0