Guest User

Untitled

a guest
Dec 11th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. day_of_year <- c(123,312,23,123,322,1,23,321,124,192)
  2. group <- c(1,1,1,1,3,3,3,2,2,2)
  3.  
  4. tapply(day_of_year, group, mean)
  5. # 1 2 3
  6. #145.2500 212.3333 115.3333
  7.  
  8. install.packages('dplyr')
  9. library('dplyr')
  10.  
  11. New.Data.Frame <- Your.Data.Frame >%>
  12. group_by(,group)>%>
  13. summarise(,Mean_Day_of_Year= mean(day_of_year ) )
Add Comment
Please, Sign In to add comment