r mean function code example Example: R average function name myData <- c(10, 4, 50, 30, 26) # Average mean(myData)