Is it possible to emit a warning if a package hasn't been loaded?
If possible, I would prefer that the solution not require \usepackage{ifthen} as it couldn't emit the warning that it was missing the ifthen package.
EDIT: Thanks Martin and Joseph for the responses. I would like to clarify my question: is it possible do to this from within the body of a document?
The \AtBeginDocument, \RequirePackage and \@ifpackageloaded are only available in the preamble. The ltxcmds package makes \ltx@ifpackageloaded available in the body but then the ltxcmds package is required for this to work.
The situation where I would like this is I am generating tables with the xtable package in R and when the floating.environment='sidewaystable' argument is used, the rotating package is required. To make this easy for users, I would like to allow them to simply \input{<path_to_xtable>}. However, if the rotating package isn't loaded pdflatex give an error message like
l.3 \begin{sidewaystable}
[ht]
?
I would prefer that it issue a more informative warning that the rotating package is missing. Is this possible?