-2

I have a dataframe known as Tgame containing two columns game and hours_played. I am trying to remove duplicates in the column game and also sum up the average for column hours_played for game column.

sindri_baldur
  • 25,109
  • 3
  • 30
  • 57
  • 1
    Please give a [mre] in your question! Read https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – jogo Oct 21 '19 at 11:20

1 Answers1

1

Should be as simple as this (using data.table):

library(data.table)
setDT(Tgame)[, mean(hours_played), by = game]
sindri_baldur
  • 25,109
  • 3
  • 30
  • 57