{"id":2726,"date":"2022-12-05T01:03:53","date_gmt":"2022-12-05T01:03:53","guid":{"rendered":"http:\/\/optimumsportsperformance.com\/blog\/?p=2726"},"modified":"2022-12-05T14:57:38","modified_gmt":"2022-12-05T14:57:38","slug":"tidyx-126-keeping-duplicates-when-pivoting-wider","status":"publish","type":"post","link":"https:\/\/optimumsportsperformance.com\/blog\/tidyx-126-keeping-duplicates-when-pivoting-wider\/","title":{"rendered":"TidyX 126: Keeping duplicates when pivoting wider"},"content":{"rendered":"<p>Working more on data engineering\/data cleaning steps, <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/twitter.com\/ellis_hughes\">Ellis<\/a><\/span><\/strong> and I talk about the <strong>pivot_wider()<\/strong> function within {<strong>tidyverse<\/strong>}. One of the issues is that when pivoting a data set to a wide format, if you have duplicate rows in the id columns\u00a0<strong>pivot_wider()<\/strong> will collapse them into a list. This may be problematic if you are needing to retain all rows in the original data set. Thus, Ellis and I discuss a method to <strong>pivot_wider()<\/strong> while retaining all rows of data, even when there are duplicate values in the <strong>id_cols<\/strong>.<\/p>\n<p>To view the screen cast, <span style=\"color: #0000ff;\"><strong><a style=\"color: #0000ff;\" href=\"https:\/\/www.youtube.com\/watch?v=sZgcWupB9G4&amp;feature=youtu.be\">CLICK HERE<\/a><\/strong><\/span>.<\/p>\n<p>To access our code, <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/github.com\/thebioengineer\/TidyX\/tree\/master\/TidyTuesday_Explained\/126-preserving_duplicated_on_pivots\">CLICK HERE<\/a><\/span><\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Working more on data engineering\/data cleaning steps, Ellis and I talk about the pivot_wider() function within {tidyverse}. One of the issues is that when pivoting a data set to a wide format, if you have duplicate rows in the id columns\u00a0pivot_wider() will collapse them into a list. This may be problematic if you are needing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[],"class_list":["post-2726","post","type-post","status-publish","format-standard","hentry","category-tidyx-screen-cast"],"_links":{"self":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/2726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/comments?post=2726"}],"version-history":[{"count":3,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/2726\/revisions"}],"predecessor-version":[{"id":2729,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/2726\/revisions\/2729"}],"wp:attachment":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/media?parent=2726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/categories?post=2726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/tags?post=2726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}