# How to calculate the total sum of an array in R language?

You can calculate the sum of an array in R using the sum() function. Here is an example code for calculating the sum of an array:

```
# 创建一个数组
arr <- c(1, 2, 3, 4, 5)
# 计算数组总和
total <- sum(arr)
# 打印结果
print(total)
```

Running the code above will output the sum of the array arr. Alternatively, you can directly pass the array to the sum() function instead of first storing it in a variable.