Slip 5
Write an R program to find Sum, Mean and Product of a Vector.
y = c(10, 20, 30)
print("Sum:")
print(sum(y))
print("Mean:")
print(mean(y))
print("Product:")
print(prod(y))
Output
> y =
c(10, 20, 30)
>
print("Sum:")
[1]
"Sum:"
>
print(sum(y))
[1] 60
>
print("Mean:")
[1]
"Mean:"
>
print(mean(y))
[1] 20
>
print("Product:")
[1]
"Product:"
>
print(prod(y))
[1] 6000