[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-573147-105":53,"doc-detail-573147-en":126},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":119,"head_meta":121,"extra_data":123,"updated_unix":125},105,"en","dplyr-data-transformation-cheatsheet","dplyr - Data Transformation Cheatsheet","","dplyr cheatsheet for data transformation using pipes and tidy data principles. Covers summarizing, counting, and grouping cases; extracting, de-duplicating, slicing, and sampling rows; applying logical conditions in filter(). Includes arranging rows, adding rows, and manipulating variables through pull, select, relocate, across, c_across, mutate, add_column, and rename. Provides a reference for vectorized functions such as lag/lead, cumulative aggregates, ranking, math/logical operations, and common helpers like case_when and coalesce.",{"@graph":63,"@context":118},[64,80,101],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/dplyr-data-transformation-cheatsheet/573147/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/dplyr-data-transformation-cheatsheet/573147.png","ImageObject",442,249,{"name":88,"@type":89},"acoobca","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-18","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":76},"InteractionCounter",{"@type":100},"ViewAction",{"@type":102,"mainEntity":103},"FAQPage",[104,110,114],{"name":105,"@type":106,"acceptedAnswer":107},"What is the core dplyr workflow described in this cheatsheet?","Question",{"text":108,"@type":109},"dplyr functions work with pipes and expect tidy data. Pipes like x |> f(y) become f(x, y), enabling readable transformation chains.","Answer",{"name":111,"@type":106,"acceptedAnswer":112},"How do you summarize and count grouped data?",{"text":113,"@type":109},"Use summarize() to create summary statistics, and count() to count rows per group. Grouping is done with group_by() before combining with summarize() or count().",{"name":115,"@type":106,"acceptedAnswer":116},"Which functions help you extract and transform rows or columns?",{"text":117,"@type":109},"Use filter() to extract rows by logical criteria, distinct() to remove duplicates, and slice() variants for positional or sampled selection. For columns, use pull() for vectors and select()/relocate()/across() for column extraction and multi-column operations.","https://schema.org",{"og:url":78,"og:type":120,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":122,"canonical":78},"index,follow",{"doc_id":124,"site_id":56},573147,1792014503,{"code":4,"msg":5,"data":127},{"doc_id":124,"user_id":128,"nickname":88,"user_avatar":129,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":130,"file_id":131,"file_url":132,"file_type":133,"file_size":134,"view_count":76,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":73,"language":135,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":136,"faqs":137,"seo_title":138,"seo_description":61,"update_tm":139,"read_time":9},3985747870733,"https://ap-avatar.wpscdn.com/davatar_a8503ba1806abce46bf441b54a3ca4cd","Data transformation with dplyr : : CHEATSHEET  \ndplyr functions work with pipes and expect tidy data. In tidy data:  \nEach variable is in its own column  \nA B C  \nEach observation, or case, is in its own row  \npipes  \nx |> f(y)  \nbecomes f(x, y)  \nSummarize Cases  \nApply summary functions to columns to create a new table of summary statistics. Summary functions take vectors as input and return one value (see back) .  \nsummarize( .data,…)  \nCompute table of summaries.  \nmtcars |> summarize(avg = mean(mpg))  \ncount( .data,…, wt = NULL, sort = FALSE, name = NULL) Count number of rows in each group defined by the variables in…Also tally(), add_count(), add_tally() .  \nmtcars |> count(cyl)  \nGroup Cases  \nUse group_by( .data,…, .add = FALSE, .drop = TRUE) to create a\"grouped\" copy of a table grouped by columns in ... dplyr functions will manipulate each \"group\" separately and combine the results.  \nmtcars |>  \ngroup_by(cyl) |> summarize(avg = mean(mpg))  \nUse rowwise( .data,…) to group data into individual rows. dplyr functions will compute results for each row. Also apply functions to list-columns. See tidyr cheat sheet for list-column workflow.  \nstarwars |>  \nrowwise() |>  \nmutate(film_count = length(films))  \nungroup(x,…) Returns ungrouped copy of table. g_mtcars \u003C-mtcars |> group_by(cyl)  \nungroup(g_mtcars)  \nManipulate Cases  \nEXTRACT CASES  \nRow functions return a subset of rows as a new table.  \nfilter( .data,…, .preserve = FALSE) Extract rows that meet logical criteria.  \nmtcars |> filter(mpg > 20)  \ndistinct( .data,…, .keep_all = FALSE) Remove rows with duplicate values.  \nmtcars |> distinct(gear)  \nslice( .data,…, .preserve = FALSE) Select rows by position.  \nmtcars |> slice(10:15)  \nslice_sample( .data,…, n, prop, weight_by = NULL, replace = FALSE) Randomly select rows. Use n to select a number of rows and prop to select a fraction of rows.  \nmtcars |> slice_sample(n = 5, replace = TRUE)  \nslice_min( .data, order_by,…, n, prop, with_ties = TRUE) and slice_max() Select rows with the lowest and highest values.  \nmtcars |> slice_min(mpg, prop = 0.25)  \nslice_head( .data,…, n, prop) and slice_tail() Select the first or last rows.  \nmtcars |> slice_head(n = 5)  \nLogical and boolean operators to use with filter()  \n== \u003C \u003C= [is. na](is. na) () %in% | xor()  \n!= > >= () ! &  \nSee ?base::Logic and ?Comparison for help.  \nARRANGE CASES  \narrange( .data,…, .by_group = FALSE) Order rows by values of a column or columns (low to high), use with desc() to order from high to low. mtcars |> arrange(mpg)  \nmtcars |> arrange(desc(mpg))  \nADD CASES  \nadd_row(.data,…, . before = NULL, .after = NULL) Add one or more rows to a table.  \ncars |> add_row(speed = 1, dist = 1)  \nManipulate Variables  \nEXTRACT VARIABLES  \nColumn functions return a set of columns as a new vector or table.  \npull( .data, var = -1, name = NULL,…) Extract column values as a vector, by name or index. mtcars |> pull(wt)  \nselect( .data,…) Extract columns as a table. mtcars |> select(mpg, wt)  \nrelocate( .data,…, . before = NULL, .after = NULL) Move columns to new position.  \nmtcars |> relocate(mpg, cyl, . after = last_col())  \nUse these helpers with select() and across()  \ne.g. mtcars |> select(mpg:cyl)  \ncontains(match) num_range(prefix, range) :, e.g., mpg:cylends_with(match) all_of(x)/any_of(x,…, vars) !, e.g., !gear  \nstarts_with(match) matches(match) everything()  \nMANIPULATE MULTIPLE VARIABLES AT ONCE  \ndf \u003C-tibble(x_1 = c(1, 2), x_2 = c(3, 4), y = c(4, 5))  \nacross( .cols, .funs,…, . names = NULL) Summarize or mutate multiple columns in the same way.  \ndf |> summarize(across(everything(), mean))  \nc_across( .cols) Compute across columns in row-wise data.  \ndf |>  \nrowwise() |>  \nmutate(x_total = sum(c_across(1:2)))  \nMAKE NEW VARIABLES  \nApply vectorized functions to columns. Vectorized functions take vectors as input and return vectors ofthe same length as output  \nmutate( .data,…, .keep = \"all\", .before = NULL,.after = NULL) Compute new column(s) . Also add_colu","cbCaifHfkJ9ZEgMz","https://ap.wps.com/l/cbCaifHfkJ9ZEgMz","pdf",1044615,"English","# Summarize Cases\n## Group Cases\n## Manipulate Cases\n# Extract Variables\n## Manipulate Multiple Variables at Once\n# Make New Variables\n## Vectorized Functions Reference","[{\"question\":\"What is the core dplyr workflow described in this cheatsheet?\",\"answer\":\"dplyr functions work with pipes and expect tidy data. Pipes like x |\\u003e f(y) become f(x, y), enabling readable transformation chains.\"},{\"question\":\"How do you summarize and count grouped data?\",\"answer\":\"Use summarize() to create summary statistics, and count() to count rows per group. Grouping is done with group_by() before combining with summarize() or count().\"},{\"question\":\"Which functions help you extract and transform rows or columns?\",\"answer\":\"Use filter() to extract rows by logical criteria, distinct() to remove duplicates, and slice() variants for positional or sampled selection. For columns, use pull() for vectors and select()/relocate()/across() for column extraction and multi-column operations.\"}]","dplyr - Data Transformation Cheatsheet | PDF",1791933213]