Pivoting like in Excel Power Query

Hi,
my question is connected with that video:
https://www.youtube.com/watch?v=n72WsDKi0Yg
Apologies as this is in Polish but in final table after pivoting the persons are allocated to the relevant processes. That is the goal of this task.

What needs to be done so that in the solution, i.e. this resulting table, the names are not repeated, and where in the video in the columns describing a particular process, instead of the names duplicated from column F for example, the letter X or XX would appear ?
That is, for example, in the third row Amanda Carter (column F) is assigned to the Service Desk - cRSP process (column G) and her name is repeated there too. I would like there (column G , third row) to be a X instead of Amanda Carter's name.

I would appreciate your help.

The file can be downloaded from:
https://www.pmsocho.com/pobierz-pliki-do-filmow/

The name of the file is as follows and could be accessed from a drop down list:
[ex-847 - Wartości z jednej kolumny do wielu czyli piwotowanie w Power Query] (238.6 KB)]

Is this what you want? I change the file name to save typing.

library(openxlsx)
library(tidyr)
DF <- read.xlsx(xlsxFile = "~/R/Play/ex847.xlsx",sheet = "ex-847")
DF$Tag <- "X"
Pivoted <- pivot_wider(DF,names_from = "Process",values_from = "Tag")
head(Pivoted)
#> # A tibble: 6 × 11
#>   Name   Servi…¹ Servi…² Servi…³ Servi…⁴ Servi…⁵ Servi…⁶ Servi…⁷ Servi…⁸ Servi…⁹
#>   <chr>  <chr>   <chr>   <chr>   <chr>   <chr>   <chr>   <chr>   <chr>   <chr>  
#> 1 AMAND… X       <NA>    <NA>    <NA>    <NA>    <NA>    <NA>    <NA>    <NA>   
#> 2 LAURE… X       X       X       X       X       X       X       <NA>    <NA>   
#> 3 SHANN… X       <NA>    X       <NA>    <NA>    <NA>    <NA>    X       <NA>   
#> 4 LUKE … <NA>    <NA>    <NA>    <NA>    <NA>    <NA>    X       <NA>    <NA>   
#> 5 IAN J… <NA>    <NA>    <NA>    <NA>    <NA>    X       <NA>    <NA>    <NA>   
#> 6 WENDY… <NA>    <NA>    <NA>    <NA>    X       <NA>    <NA>    <NA>    <NA>   
#> # … with 1 more variable: `Service Desk - cRSP-SSL_VPN` <chr>, and abbreviated
#> #   variable names ¹​`Service Desk - cRSP-Proxies`,
#> #   ²​`Service Desk - cRSP-Service`, ³​`Service Desk - cRSP-Service_Agent`,
#> #   ⁴​`Service Desk - cRSP-Gateway`, ⁵​`Service Desk - cRSP-Reporting`,
#> #   ⁶​`Service Desk - cRSP_NG`, ⁷​`Service Desk - cRSP`,
#> #   ⁸​`Service Desk - cRSP-Firewall`, ⁹​`Service Desk - cRSP-VM`

Created on 2022-10-29 with reprex v2.0.2

Thank you very much @FJCC, exactly what I wanted.

I can understand that :grinning:

And to do similarly as in the video I tried:

DF$Names2 <- DF$Name
Pivoted2 <- pivot_wider(DF,names_from = "Process",values_from = "Names2")

Thanks again, 
best

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.