As a follow-up to a previous question, How to doublespace a table using setspace?, I found that the solution is not compatible with the sidewaystable environment defined in the rotating package.
I have modified the example in the answer from the previous question to demonstrate:
\documentclass{article}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{rotating}
\newcommand\Factor{1.9}
\makeatletter
\def\@xfloat#1[#2]{\ifhmode \@bsphack\@floatpenalty -\@Mii\else
\@floatpenalty-\@Miii\fi\def\@captype{#1}\ifinner
\@parmoderr\@floatpenalty\z@
\else\@next\@currbox\@freelist{\@tempcnta\csname ftype@#1\endcsname
\multiply\@tempcnta\@xxxii\advance\@tempcnta\sixt@@n
\@tfor \@tempa :=#2\do
{\if\@tempa h\advance\@tempcnta \@ne\fi
\if\@tempa t\advance\@tempcnta \tw@\fi
\if\@tempa b\advance\@tempcnta 4\relax\fi
\if\@tempa p\advance\@tempcnta 8\relax\fi
}\global\count\@currbox\@tempcnta}\@fltovf\fi
\global\setbox\@currbox\vbox\bgroup
\def\baselinestretch{\Factor}\@normalsize
\boxmaxdepth\z@
\hsize\columnwidth \@parboxrestore}
\makeatother
\begin{document}
\begin{spacing}{\Factor}
\lipsum[1]
\begin{sidewaystable}[ht]
\begin{tabular}{rlll}
\hline
& col1 & col2 & col3 \\
\hline
50 & 19 & 7 & 26 \\
100 & 10 & 20 & 29 \\
150 & 1 & 7 & 2 \\
200 & 0 & 0 & 10 \\
\hline
\end{tabular}
\end{sidewaystable}
\end{spacing}
\end{document}
Running pdflatex on this document returns the error:
! Extra }, or forgotten \endgroup.
\color@endbox ->\egroup
l.40 \end{sidewaystable}
How can I get around this?

