Does it make sense to use clustered standard errors outside of a regression framework? I am unsure about how to proceed in the following context. Here is some toy data from R:
 location value
     <chr> <dbl>
1      A     0  
2      A     2  
3      A     1  
4      B     2  
5      B     3  
6      B     0.4

I would like to do t-tests on value. In my mind, it would make sense to consider clustering standard errors by location if I were to use these variables in a regression. 
Is it possible considering that instead I only want to do means testing on value?
I ask because in R all packages that consider such cluster robust calculations only work when evaluating regression estimates. 
 A: Performing the regression analog of a difference in means test, or independent samples $t$-test, will give you the standard error of that difference with no extra work on your part. One crucial assumption is that the observations are independent. In your example, each value is not a realization from a new location; rather, you have multiple realizations for the same location. It is important to think about how your sample was collected when clustering.
You most likely have a sample of observations (locations) from within the same geographic region, or you have repeated observations of locations across time. Dimitriy correctly noted that your difference in means test is mathematically equivalent (assuming equal variances) to the following
$$
\mathrm{Value}_{it} = \beta_{0} + \beta_{1}\mathrm{Location}_{it},
$$
which is the outcome regressed on a two-level factor variable. I use the subscripts $i$ and $t$ which is characteristic of a panel setup. For example, observing values for location $i$ repeated over some time interval $t$. Clustering on location is easier under this framework. Be mindful, clustering on location with few clusters is not recommended. Cluster robust variance estimation can be biased downward with too few clusters. See the following paper by Pustyjovsky and Tipton 2018 for more information.
The regression formulation is useful. You can cluster. You can add more locations (40 or more clusters is preferred). You can even condition on other covariates. And lastly, you will not have to calculate the standard errors; R will do it for free.
If you only care about the overall mean, then run an intercept-only model. To be precise, set $\beta_{0} = 1$. Next, simply cluster on your location variable. I hope that helps!
