0

I have a...

# A tibble: 6 x 10
  CCG18CD   CCG18CDH CCG18NM                      STP18CD   STP18NM           LAD18CD   LAD18NM      PCON16CD PCON16NM        Dummy
  <chr>     <chr>    <chr>                        <chr>     <chr>             <chr>     <chr>        <chr>    <chr>           <dbl>
1 E38000035 07T      NHS City and Hackney CCG     E54000029 North East London E09000001 City of Lon~ E140006~ Cities of Lond~     1
2 E38000035 07T      NHS City and Hackney CCG     E54000029 North East London E09000001 City of Lon~ E140006~ Cities of Lond~     1
3 E38000035 07T      NHS City and Hackney CCG     E54000029 North East London E09000001 City of Lon~ E140006~ Cities of Lond~     1
4 E38000035 07T      NHS City and Hackney CCG     E54000029 North East London E09000001 City of Lon~ E140006~ Cities of Lond~     1
5 E38000004 07L      NHS Barking and Dagenham CCG E54000029 North East London E09000002 Barking and~ E140005~ Barking             1
6 E38000004 07L      NHS Barking and Dagenham CCG E54000029 North East London E09000002 Barking and~ E140005~ Barking             1

I want to do a pivot-like transformation of the PCON16CD column, with:

* each distinct variable in this column/field taking a row of a new tibble

* columns generated from the variables in the current column CCG18CD

* Values being populated with a count of the column Dummy, with results shown as a percent of row total.

...that is, all bread and butter stuff in Excel, but a task I'm struggling to get my head round for R

RHinks
  • 41
  • 5

0 Answers0