Skip to content

Commit

Permalink
tidydocs
Browse files Browse the repository at this point in the history
  • Loading branch information
nrennie committed Dec 2, 2024
1 parent 07f19df commit fea7863
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 6 deletions.
3 changes: 3 additions & 0 deletions R/add_special_chars.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#' @export
#' @examples
#' add_special_chars(mtcars)

add_special_chars <- function(data,
cols = NULL,
messiness = 0.1) {
Expand Down Expand Up @@ -50,7 +51,9 @@ add_special_chars <- function(data,
#' @param messiness Percentage of values to change. Must be
#' between 0 and 1. Default 0.1.
#' @return Messy character vector
#' @author Athanasia Monika Mowinckel
#' @noRd

special_chars <- function(x, messiness = 0.1) {
# if factor, convert to character
if (is.factor(x)) {
Expand Down
2 changes: 2 additions & 0 deletions R/duplicate_rows.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
#' between 0 and 1. Default 0.1.
#' @param shuffle Insert duplicated data underneath original data or insert randomly
#' @return A dataframe with duplicated rows inserted
#' @author Philip Leftwich
#' @export
#' @examples
#' duplicate_rows(mtcars, messiness = 0.1)

duplicate_rows <- function(data, messiness = 0.1, shuffle = FALSE) {
if (messiness < 0 || messiness > 1) {
stop("'messiness' must be between 0 and 1")
Expand Down
2 changes: 2 additions & 0 deletions R/messy_colnames.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
#' @param messiness Percentage of values to change per function. Must be
#' between 0 and 1. Default 0.1.
#' @return data.frame with messy column names
#' @author Athanasia Monika Mowinckel
#' @export
#' @examples
#' messy_colnames(mtcars)

messy_colnames <- function(data, messiness = 0.2) {
new_names <- data.frame(x = names(data)) |>
add_special_chars(messiness = messiness) |>
Expand Down
2 changes: 1 addition & 1 deletion R/messy_dates.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#'
#' @examples
#' data <- data.frame(dates = rep(Sys.Date(), 10))
#'
#' messy_date_formats(data)

messy_datetime_formats <-
function(data,
cols = NULL,
Expand Down
3 changes: 1 addition & 2 deletions R/split_datetimes.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
#' @examples
#' # split datetimes
#' data <- data.frame(today = Sys.time())
#' data
#' split_datetimes(data)
#'

split_datetimes <-
function(data,
cols = NULL,
Expand Down
3 changes: 3 additions & 0 deletions man/duplicate_rows.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/messy-date-fmt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/messy_colnames.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions man/split-dates.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fea7863

Please sign in to comment.