Description Usage Arguments Details Value Examples
This function finds row-wise min-max values in two columns of a given dataframe.
1 |
df |
data frame with at least two columns. |
col1 |
character. must be a column of df. |
col2 |
character. must be a column of df. |
unique |
if TRUE, duplicate rows are removed from the returned data frame. |
Given a data frame (df) and two of its columns (col1 and col2), this function re-arranges the content of these columns so that the first and second column contains the rowwise minimum and the rowwise maximum of the two columns, respectively. Factor values are sorted by their labels. If there are other columns in df, those columns remain unchanged. if unique = TRUE, the output data frame contains only unique rows.
Note: both columns must have same type of data.
A data frame with the same set of columns as df.
1 2 | my_df = data.frame(A=c(1,5,2,9,1), B = LETTERS[1:5], C=c(1,3,5,7,9))
# my_minmax_df = rminmax_df(my_df, col1='A', col2 = 'C')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.