The following equation is standard in thermodynamics: 

$$
\Delta G^\circ=-RT\log(K)
$$

where $K$ is the equilibrium constant.  In dimensional analysis, Bridgman's theorem tells us that the argument of a transcendental function (like $\log$) must always be dimensionless.  But $K$ may have dimensions (depending on the particular equilibrium).  Why is this OK?  



Note: working out dimensions explicitly gives: 

\begin{align}
[R]&=EN^{-1}\Theta^{-1}\\
[T]&=\Theta\\
[\Delta G^\circ]&=EN^{-1}
\end{align}

where $\Theta$ is the dimensions of temperature, $N$ is the dimensions of number and $E$ = dimensions of energy = $MLT^{-2}$.  From these, we see that the quantity $\log(K)$ ought to be dimensionless, implying that $K$ should be dimensionless as well.  But it isn't always.  

Furthermore, suppose $K$ has dimensions $NL^{-3}$ (for an equilibrium of the form $A+B\leftrightarrow AB$, say).  Suppose now that we scale the units for number by a factor $a$.  Then we get new values for $K,R,\Delta G^\circ$, given by: 

\begin{align}
\hat K&=K/a\\
\hat R&=aR\\
\hat{\Delta G^\circ}&=a\Delta G^\circ
\end{align}

From our original equation: 

\begin{align}
\Delta G^\circ&=-RT\log(K)\\
a\Delta G^\circ&=-aRT\log(K)\\
\hat{\Delta G^\circ}&=-\hat RT\log(a\hat K)\\
\hat{\Delta G^\circ}&=-\hat RT\log(\hat K)-\hat RT\log(a)
\end{align}

So the new quantities do not satisfy the old equation.  Rather, they satisfy the old equation, but with a constant factor of $-\hat RT\log(a)$ added on.  What is going on here?

The problem is that people are often sloppy with the definition of quantities. The equilibrium constant $K$ in your first equation is indeed a dimensionless quantity while the equilibrium constant $K_c$ that is usually used to describe an equilibrium in a solution is not. I will take some detour to show where they come from and how they are connected.

From thermodynamics it is known that the Gibbs free energy of reation is given by
\begin{equation}
 \Delta G = \left( \frac{\partial G}{\partial \xi} \right)_{p,T} = \sum \nu_{i} \mu_{i} \ ,
\end{equation}

where $\xi$ is the extent of reaction and $\nu_{i}$ and $\mu_{i}$ are the stochiometric coefficient and the chemical potential of the $i^{\text{th}}$ component in the reaction, respectively.
Now, imagine the situation for a ideal system consisting of two phases, one purely consisting of component $i$ and the other being a mixed phase comprised of components $1, 2, \dots, k$, in equilibrium.
Since the system is in equilibrium and shows ideal behavior we know that the chemical potential of component $i$ in the mixed phase (having the temperature $T$ and the total pressure $p$), $\mu_{i}(p, T)$, must be equal to the chemical potential, $\mu^{*}_{i}(p_{i}, T)$, of the pure phase having the same temperature but a different pressure $p_{i}$, whereby $p_{i}$ is equal to the partial pressure of component $i$ in the mixed phase, namely
\begin{equation}
 \mu_{i}(p, T)= \mu^{*}_{i}(p_{i}, T).
\end{equation}
From Maxwell's relations it is known that
\begin{equation}
 \left( \frac{\partial \mu^{*}_{i}}{\partial p} \right)_{T} = \left( \frac{\partial}{\partial p} \biggl(\frac{\partial G^{*}}{\partial n_{i}}\biggr) \right)_{T} = \Biggl( \frac{\partial}{\partial n_{i}} \underbrace{\biggl(\frac{\partial G^{*}_{i}}{\partial p}\biggr)}_{=\, V_{i}} \Biggr)_{T} = \left( \frac{\partial V_{i}}{\partial n_{i}} \right)_{T}
\end{equation}

but since $\mu^{*}_{i}$ is associated with a pure phase, $\left( \frac{\partial V_{i}}{\partial n_{i}} \right)_{T}$ can be simplified to
\begin{equation}
 \left(\frac{\partial V_{i}}{\partial n_{i}} \right)_{T} = \frac{V_{i}}{n_{i}} = v_{i}
\end{equation}

and one gets
\begin{equation}
 \left( \frac{\partial \mu^{*}_{i}}{\partial p} \right)_{T} = v_{i} \ ,
\end{equation}

where $p$ is the total pressure and $v_i$ is the molar volume of the $i^{\text{th}}$ component in the pure phase.
Substituting $v_{i}$ via the ideal gas law and subsequently integrating this equation w.r.t. pressure using the total pressure $p$ as the upper and the partial pressure $p_{i}$ as the lower bound for the integration we get
\begin{equation}
 \int^{\mu^{*}_{i}(p)}_{\mu^{*}_{i}(p_{i})} \mathrm{d} \mu^{*}_{i} = \int_{p_{i}}^{p} \underbrace{v_{i}}_{=\frac{RT}{p}} \mathrm{d} p = R T \int_{p_{i}}^{p} \frac{1}{p} \mathrm{d} p = RT \int_{p_{i}}^{p} \mathrm{d} \ln p   \ ,
\end{equation}
so that, introducing the mole fraction $x_{i}$,
\begin{equation}
 \mu_{i}^{*} (p_{i}, T) = \mu_{i}^{*}(p, T) + RT \ln \Bigl(\underbrace{\frac{p_{i}}{p}}_{= x_{i}}\Bigr) = \mu_{i}^{*}(p, T) + RT \ln x_{i} \ .
\end{equation}
Please, note that there is a dimensionless quantity inside the logarithm.
Now, for real gases one has to adjust this equation a little bit: one has to correct the pressure for the errors introduced by the interactions present in real gases. Thus, one introduces the (dimensionless) activity $a_{i}$ by scaling the pressure with the (dimensionless) fugacity coefficient $\varphi_{i}$
\begin{equation}
a_{i} = \frac{\varphi_{i} p_{i}}{p^0}
\end{equation}
where $p^{0}$ is the standard pressure for which $\varphi_{i}=1$ by definition.
When this is in turn substituted into the equilibrium equation, whereby the total pressure is chosen to be the standard pressure $p = p^{0}$, the following equation arises
\begin{equation}
 \mu_{i} (p, T) = \underbrace{\mu_{i}^{*}(p^{0}, T)}_{= \, \mu_{i}^{0}} + RT \ln a_{i} \ .
\end{equation}
Substituting all this togther in our equation for $\Delta G$ and noting that the sum of logarithms can be written as a logarithm of products, $\sum_{i} \ln i = \ln \prod_i i$, one gets
\begin{equation}
 \Delta G = \underbrace{\sum_i \nu_{i} \mu_{i}^{0}}_{= \, \Delta G^{0}} + RT \underbrace{\sum_i \nu_{i} \ln a_{i}}_{= \, \ln \prod_{i} [a_{i}]^{\nu_{i}}} = \Delta G^{0} + RT \ln \prod_{i} [a_{i}]^{\nu_{i}} \ ,
\end{equation}
where the standard Gibbs free energy of reaction $\Delta G^{0}$ has been introduced by asserting that the system is under standard pressure.
Now, we are nearly finished. One only has to note that $\Delta G = 0$ since the system is in equilibrium and then one can introduce the equilibrium constant $K$, so that
\begin{equation}
\ln \underbrace{\prod_i [a_{i}]^{\nu_{i}}}_{= \, K} = -\frac{\Delta G^{0}}{RT} \qquad \Rightarrow \qquad \ln K = -\frac{\Delta G^{0}}{RT} \ .
\end{equation}
So, you see this quantity is dimensionless. The problem is that activities are hard to come by. Concentrations $c_{i}$ or pressures are much easier to measure. So, what one does now, is to introduce a different equilibrium constant
\begin{equation}
 K_{c} = \prod_i [c_{i}]^{\nu_{i}} \ .
\end{equation}
which is much easier to measure since it depends on concentrations rather than activities. It is not dimensionless but being connected with the "real" dimensionless equilibrium constant via
\begin{equation}
 K = \prod_i [\varphi_{i}]^{\nu_{i}} \left(\frac{RT}{p^{0}}\right)^{\sum_i \nu_{i}} K_{c} \ .
\end{equation}
it is more or less proportional to $K$ and thus gives qualitatively the same information.

Edit: If the solution at hand behaves like an ideal solution then by definition it's activity/fugacity coefficient is equal to one. Furthermore the state of ideality is defined with respect to standard states: for an ideal solution this is $c^{\ominus} = 1 \, \text{mol}/\text{L}$. Using this together with the ideal gas law on the relation between $K$ and $K_{c}$
\begin{equation}
 K = \prod_i [\underbrace{\varphi_{i}}_{= \, 1}]^{\nu_{i}} \Bigl(\underbrace{\frac{RT}{p^{0}}}_{\substack{= \, 1/c^{\ominus} \, = \, 1 \, \text{L} / \text{mol} \\ \text{per definition}}}\Bigr)^{\sum_i \nu_{i}} K_{c} \qquad \Rightarrow \qquad K = \left(\frac{L}{\text{mol}} \right)^{\sum_i \nu_{i}} K_{c} \ .
\end{equation}
one sees that for an ideal solution $K_{c}$ is identical to $K$ scaled by a dimensional prefactor.

Edit: I forgot to mention there are also "versions" of the equilibrium constants that are defined in terms of partial pressures or mole fractions which provide a more suitable description for gas equlibria but all those "versions" can be traced back to the original equilibrium constant.
