  We will give new applications of quantum groups to the study of spherical
Whittaker functions on the metaplectic $n$-fold cover of $GL(r,F)$, where $F$
is a nonarchimedean local field. Earlier Brubaker, Bump, Friedberg, Chinta and
Gunnells had shown that these Whittaker functions can be identified with the
partition functions of statistical mechanical systems. They postulated that a
Yang-Baxter equation underlies the properties of these Whittaker functions. We
confirm this, and identify the corresponding Yang-Baxter equation with that of
the quantum affine Lie superalgebra
$U_{\sqrt{v}}(\widehat{\mathfrak{gl}}(1|n))$, modified by Drinfeld twisting to
introduce Gauss sums. (The deformation parameter $v$ is specialized to the
inverse of the residue field cardinality.) For principal series representations
of metaplectic groups, the Whittaker models are not unique. The scattering
matrix for the standard intertwining operators is vector valued. For a simple
reflection, it was computed by Kazhdan and Patterson, who applied it to
generalized theta series. We will show that the scattering matrix on the space
of Whittaker functions for a simple reflection coincides with the twisted
$R$-matrix of the quantum group $U_{\sqrt{v}}(\widehat{\mathfrak{gl}}(n))$.
This is a piece of the twisted $R$-matrix for
$U_{\sqrt{v}}(\widehat{\mathfrak{gl}}(1|n))$, mentioned above.
