Try this:

xtabs(value ~ Grade + location, data = dat)



On 6/18/08, Zolfaghari, Arvin <[EMAIL PROTECTED]> wrote:
>
> Hi list,
> I am trying to convert my Data from 1st following format to the second.
> Any comment?
>
> You could copy following in Tinn R
> Data<-
> data.frame(location=c("postcode","sector","long/lat","sector"),Grade=c("
> h","m","L","h"),value=c(2,3,5,6))
> #Question: how can I reshape Data to the following
> #     Grade   postcode    sector   long/lat
> #        h    2            6         0
> #        m    0            3         0
> #        l    0            0         5
>
>
> Regards,
>
> Arvin Zolfaghari
> Lead Researcher, PhD MSc BSc
> Lloyd's Exposure Management
> Telephone +44 (0)20 7327 5983
> www.lloyds.com <http://www.lloyds.com/>
>
> SAVE PAPER - THINK BEFORE YOU PRINT
>
>
> **********************************************************************
> The information in this E-Mail and in any attachments is...{{dropped:22}}
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  • [R] Question Zolfaghari, Arvin
    • Re: [R] Question Henrique Dallazuanna

Reply via email to