Determine mean from data and variance I have some data x[i] that differ from the true values by random measurement errors cx. Hence one can write
x[i] ~ N(mu,cx)

My question is: how can I determine mu knowing only x[i] and cx?
Thanks in advance
 A: The short (and boring) answer is that you can use the sample mean $\frac{1}{n} \sum\limits_{i=1}^{n} x_{i} $ to get the "right" estimate of mu.
The longer (and much more interesting) answer is that you can use the sample mean as the best estimate of the population mean in a normal distribution with known variance because the sample mean is "sufficient" for the population mean in such a setting.
Sufficient statistics are functions of the data intended to estimate population parameters such that no other functions of the data provide additional info about those parameters. It's pretty easy to show that this is the case for the sample mean in a normal with fixed variance by using what's known as the factorization theorem. 
Further, there are particular kinds of sufficient statistics (complete sufficient stats and minimal sufficient stats) that give your statistic other properties you may be interested in and, because the normal distribution is an exponential family, your particular statistic will have these nice properties.
I basically threw a bunch of jargon at you hoping some of it would be interesting and you would google/look on here for fuller explanations. Let me know if you want more, I'd be happy to help.
A: I assume, you know your data is normally distributed and you only need to find an estimate for the expectation and the variance. A possible estimator is the so called Maximum Likelihood Estimator (MLE). If you know the distribution but not the parameters of your data, it finds the parameters of the distribution from which your data was most likely drawn.
For a normal distribution, the MLE for the expectation is the sample mean and the empirical variance for the variance. Please note, the empirical variance defined as $\frac{1}{n}\sum(x_i - \overline{x})$ is a biased estimator. However, R gives you the unbiased sample variance. In order to obtain the MLE estimator for the variance, you need to rescale the output of the function var() by $\frac{n-1}{n}$. See the sample code:

x <- 1:20 #sample data: not normal; only for purpose of presentation
n <- length(x)
m <- mean(x) #sample mean
sv <- var(x) #sample variance
mle_var <- sv*(n-1)/n #MLE variance

