order_samples: Reorder a dataframe by contents of a column.

Description Usage Arguments Details Value

View source: R/functions_clean_GM.R

Description

Function order_samples() takes a data frame and reorders the rows by the contents of a specified column.

Usage

1
order_samples(sample_df, sample_ref = "sample_ref")

Arguments

sample_df

A data frame containing the rows to be sorted.

sample_ref

A character vector with a single element. This must be the name of the column containing elements by which you wish to reorder the rows. Defaults to "sample_ref" for ease of use with split_filename().

Details

Ordering is done using function order(), which has its own particular methods for ordering character vectors. Numeric sample reference codes stored as characters are first coerced to numeric so they can be sorted sequentially, if doing so does not produce NAs.

Value

A data frame with rows reordered by the contents of the specified column. Rownames are overwritten with a simple sequence of numbers.


mixtrak/wellington.aquifer.ecol documentation built on Nov. 30, 2017, 4:25 a.m.