[R] trouble converting an array to a dataframe

hadley wickham h.wickham at gmail.com
Thu Jan 22 16:39:51 CET 2009


On Thu, Jan 22, 2009 at 9:09 AM, Christopher W. Ryan
<cryan at binghamton.edu> wrote:
> I probably did not explain my data clearly. I am starting with a
> dataframe with three columns:
>
> redlognumb     radiologist    barrtotal
>
> where the entries in the variable radiologist are either 1 or 2,
> indicating which radiologist generated that barrtotal. All subjects had
> their X-ray read independently by both radiologists. So there are two
> rows for each subject.
>
> I want to convert it to this structure:
>
> redlognumb    radiologist.1.barrtotal    radiologist.2.barrtotal
>
> in which there is only one row for each subject.
>
> At any rate, in the meantime, I think I figured out that I was "melting"
> improperly, and I think I've got it now.  Thanks.

You should just be able to cast like:

cast(m, redlognumb ~ radiologist + variable)

If you haven't already, you might want to look at the introduction
available at http://had.co.nz/reshape

Regards,

Hadley

-- 
http://had.co.nz/




More information about the R-help mailing list