View source: R/S03_Utilities.R
column_by_other | R Documentation |
A function that takes two columns in a data frame and reports the unique values of one column associated with the unique values of the other column.
column_by_other(dtf, col1, col2)
dtf |
A data frame. |
col1 |
The first column (non-standard evaluation possible). |
col2 |
The second column (non-standard evaluation possible). |
A data frame with the unique values of the first column associated with the unique values of the second.
Kevin Potter
# Define a data frame
dtf <- data.frame(
A = c( 1, 1, 2, 2, 3, 3 ),
B = c( 'A', 'A', 'B', 'B', 'C', 'D' )
)
# Values of column 'B' by values of column 'A'
column_by_other( dtf, A, B )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.