Is there a relation between the p-values of coefficients and the $R^2$ in an OLS regression? I have a very simple question. I know that the R-squared is the proportion of the variance for a dependent variable that's explained by an independent variable or variables in a regression model.
I also know that the p-value is the probability of obtaining test results at least as extreme as the results actually observed, under the assumption that the null hypothesis is correct.
My question essentially is, is the value of the R-squared only dependent on the coefficients? Or also on the significance of the coefficients? In other words, does an increase in the p-value of a Beta estimate, ceteris paribus (everything else equal) affect the R-squared?
 A: I realised shortly after posting, that my question can be quite easily answered by running a regression with and without robust standard errors.
I found a Stata example that does just that here: https://www.statology.org/robust-standard-errors-stata/
The R-squared stays the same, so the p-value (affected by robust standard errors) does not change the R-squared.
A: 
Is there a relation between the p-values of coefficients and the R2 in
an OLS regression?

In variables selection context if we add one regressor the $R^2$ increase, or at worst remain the same. So if you add and add regressors, $R^2$ approach to 1.
Moreover, is less known that if the regressor added have a p-value less than $0,32$ (about) also the $R_{adj}^2$ increase. So, this indicator tell us that more significative the regressors are more the $R^2$ increase.
Related: Should $ R^2$ be calculated on training data or test data? How to calculate out of sample R squared?
A: The F-statistic on which the computation of a p-value is based can be expressed in terms of $R^2$ (and also the degrees of freedom).
See also Does $r$-squared have a $p$-value?
The relationship between $R^2$ and the F-statistic is for simple linear regression with a sample of size $n$ the following
$$F = \frac{R^2}{1-R^2} (n-2)$$
So yes, there is a relation between p-value and $R^2$.
In the case of OLS regression other than simple linear regression, then the relationship will be more complex and the F statistic is expressed in terms of the two $R^2$ values of the model with and without the parameter included

Example
Below is a demonstration by simulating uncorrelated data (sample size $n=10$ with data from normal distribution) and computing the p-value for the slope coefficient as well as the $R^2$ value. In the figure we see that the two are related.

sim = function(n = 10) {
   # simulate uncorrelated data
   x = rnorm(n)
   y = rnorm(n)
   
   # compute r^2 and p-value
   mod = lm(y~x)
   r2 = summary(mod)$r.squared
   p = summary(mod)$coefficients[,4][2]

   return(list(r2=r2,p=p))
}

set.seed(1)

plot(-100,-100, xlim = c(0,1), ylim = c(0,1),
     xlab = "p-value", ylab = "R squared")

for (i in 1:1000) {
    s = sim()
    points(s$p,s$r2,
           pch = 21, col = 1, bg = 1, cex = 0.7)
}

A: The $R^2$ is a function of the explained error and the total error. The $p$-value for a coefficiant is a function of the $t$ statistic for that coefficient which includes the standard error in the denominator. The standard error of a coefficient is also function of the explained error among other inputs. As the values both partially depend on the same inputs, it's fair to say there is a relationship. This PDF gives a more explicit functional form for the relationship between a coefficient's standard error and the $R^2$.
