Given we observe $x$ successes in sample of $n$, what is the probability that $p>0.5$ I flip a coin $n$ times, and I find that for $x$ of these it lands on heads. Let $p$ be the true probability of the coin landing on heads, though this is currently unknown.
I am interested in $P(p>0.5 \mid$ I flipped it $n$ times seeing $x$ occurrences of heads$)$.
I would really appreciate if someone could help me with:
(a) Working this probability out
(b) If there's a function in R I could use to do this (inputting the $n$ and $x$ I have for the different coins).
 A: Well the probability that you are asking for is not computable, at least not using frequentist statistics. Observe that in general, a conditional probability is computed as 
$$P(A|B)=\dfrac{P(A\cap B)}{P(B)}$$
But here, $P(B)=$ I flipped the coin n times seeing x occurrences of heads. And for this probability we would need to know the value of $p$.
You can, as sugested in the comments, consider a Bayesian perspective, but for doing that you would require knowledge on a prior distribution.
What you can actually do from a frequentist perspective is to comupte a hypothesis test. For doing this, you should define your null hypothesis:
$$H_0: p=0.5$$
And the alternative hypothesis , which is:
$$H_1:p>0.5$$
Now we can compute the test statistic 
$$
T = \frac{\hat{p}-p_{0}}{\sqrt{p_{0}\left(1-p_{0}\right) / n}} \sim_{a p} N(0,1)
$$
where $p_0=0.5$ (the value under your null hypothesis) and $\hat{p}=x/n$ is the sample proportion. plugging in the values for $p_0$ annd $\hat{p}$, T is an actual number. 
Now consider a significance level $\alpha = 0.05$ for your test. Then you can check using for example, the program R, that $z_{\alpha}=1.64$. This means that $P(N(0,1)>1.64) = 0.05$
Finally, assuming that the null hypothesis is true, T is drawn approximately from a normal distribution, so you can compare T against the value you would expect from a normal distribution, which is 1.64


*

*If $T>1.64$ then T is a strange value, because it has a probability of being from a normal distribution smaller than 5%. You reached this conclusion assuming that the null hypothesis was true, so you conclude that the null hypothesis should be rejected and the alternative hypothesis should be supported.

*If $<=1.64$ you cannot reject the null hypothesis.
Doing this in R:
n = 100 # number of tosses
x = 60 # number of heads 
p = 0.5 # your null hypothesis probability

binom.test(x=x, n=n, p=p, alternative='greater', conf.level=0.95)

Which returns
Exact binomial test

data:  x and n
number of successes = 60, number of trials = 100, p-value = 0.02844
alternative hypothesis: true probability of success is greater than 0.5
95 percent confidence interval:
  0.5129758 1.0000000
sample estimates:
  probability of success 
0.6 

So the p-value here is $0.02844$. If the p-value is smaller than $\alpha=0.05$ then you do not reject the null hypotheis. If the p-value is greater than $\alpha$ then you reject the null hypothesis
