Raggedleft paragraph in a table

You have to restore \\ for use in tabular after inserting switches like \raggedleft in the last column. See the array manual for details.

\documentclass{article}
\usepackage{array}

\newcommand{\lorem}{Lorem ipsum dolor sit amet, consectetur adipisicing elit.}

\begin{document}
  \begin{tabular}{p{5cm}>{\raggedleft\arraybackslash}p{5cm}}
    \lorem&\lorem\\
    \lorem&\lorem
  \end{tabular}
\end{document}

Is there a better way?

I would say yes. I suggest to use \RaggedLeft instead: there's no \arraybackslash fix required and the justification is better, regarding that there's hyphenation within p columns.

Explanation:

For a better illustration, let's reduce the p column width. Here's the \raggedleft way:

\documentclass{article}
\usepackage{array}
\newcommand{\lorem}{Lorem ipsum dolor sit amet, consectetur adipisicing elit.}
\begin{document}
  \begin{tabular}{p{30mm}>{\raggedleft\arraybackslash}p{30mm}}
  \lorem&\lorem
  \end{tabular}
\end{document}

alt text

Now we change:

\usepackage{ragged2e}
...
  \begin{tabular}{p{30mm}>{\RaggedLeft}p{30mm}}

alt text

It's not so extremely ragged because now hyphenation is supported, just like in the p cell on the left.

Further notes:

  • The content of p cells is fully justified. This may cause undesired gaps between words and does not match the ragged way on the right side. A \RaggedRight for the left p cell could be a good and consistent idea.

  • Especially in narrow columns additionally inserting \hspace{0pt} ensures proper hyphenaton. Otherwise, TeX would not hyphenate the first word of the box.

Since a new column type makes all easier, my choice would be

\newcolumntype{L}[1]{>{\RaggedRight\hspace{0pt}}p{#1}}
\newcolumntype{R}[1]{>{\RaggedLeft\hspace{0pt}}p{#1}}

and in the body text I'd just write

\begin{tabular}{L{30mm}R{30mm}}