collapse_rows: Collapse row values from a table into a list for pretty...

View source: R/collapse_rows.R

collapse_rowsR Documentation

Collapse row values from a table into a list for pretty printing

Description

This function folds values of a many to one relationship together in a single character composed of comma separated values.

Usage

collapse_rows(df, group_by_var, many_mapping_col)

Arguments

df

dataframe, tibble, The data structure to work on

group_by_var

tidy-eval, character The variable to group by

many_mapping_col

The column of values that will collapse into a list.

Details

The inputs can be anything that can be input into the paste function.

Value

The inputs pasted together as a character string.

Examples


#example data 
nodes_tot=data.frame(
 FirstName=sample(c('A','B','C'),size = 50,replace=TRUE),
 LastName=sample(c('1','2','3'),size = 50,replace=TRUE),
 Latitude=sample(c('D','E','F'),size = 50,replace=TRUE),
 Longitude=sample(c('4','5','6'),size = 50,replace=TRUE))
#---------

collapse_rows(nodes_tot,FirstName,Longitude)
 

aarong1/RshinyHelpers documentation built on June 15, 2022, 4:52 a.m.