The variance corresponds to the average of the squared differences from the mean.

Not sure to understand? Take any entry in your dataset, calculate the difference between its value and the mean, and then square it. Do the same for all the entries in the dataset. Eventually, calculate the average of these squared differences and you get the variance… Easy!

In R, the function that calculates the variance is var():

my.dataset <- c(1,2,3,4,5,6,7,8,9,10)
## [1] 9.166667