Skip to content

Commit

Permalink
Merge pull request #71 from 0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q/dev/df_v…
Browse files Browse the repository at this point in the history
…ariation

add df_variation()
  • Loading branch information
0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q authored Oct 9, 2023
2 parents bb3fd92 + 5803261 commit b4289f2
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '613325970'
ValidationKey: '613522360'
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'quitte: Bits and pieces of code to use with quitte-style data frames'
version: 0.3123.0
version: 0.3124.0
date-released: '2023-10-09'
abstract: A collection of functions for easily dealing with quitte-style data frames,
doing multi-model comparisons and plots.
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: quitte
Title: Bits and pieces of code to use with quitte-style data frames
Version: 0.3123.0
Version: 0.3124.0
Date: 2023-10-09
Authors@R: c(
person("Michaja", "Pehl", , "[email protected]", role = c("aut", "cre")),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export(chooseFilter)
export(df.2.named.vector)
export(df.as.list)
export(df_populate_range)
export(df_variation)
export(duplicate)
export(duplicate_)
export(factor.data.frame)
Expand Down
22 changes: 22 additions & 0 deletions R/df_variation.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#' Data Frame Variation
#'
#' Removes all columns from a data frame which have only identical data, to
#' facilitate a quick overview.
#'
#' @param x A data frame.
#'
#' @return A data frame.
#'
#' @examples
#' (quitte_example_data['Consumption' == quitte_example_data$variable,] -> x)
#'
#' df_variation(x)

#' @export
df_variation <- function(x) {
for (i in rev(seq_len(ncol(x))))
if (1 == length(unique(x[[i]])))
x[[i]] <- NULL

return(x)
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Bits and pieces of code to use with quitte-style data frames

R package **quitte**, version **0.3123.0**
R package **quitte**, version **0.3124.0**

[![CRAN status](https://www.r-pkg.org/badges/version/quitte)](https://cran.r-project.org/package=quitte) [![R build status](https://github.com/pik-piam/quitte/workflows/check/badge.svg)](https://github.com/pik-piam/quitte/actions) [![codecov](https://codecov.io/gh/pik-piam/quitte/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/quitte) [![r-universe](https://pik-piam.r-universe.dev/badges/quitte)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -47,7 +47,7 @@ In case of questions / problems please contact Michaja Pehl <michaja.pehl@pik-po

To cite package **quitte** in publications use:

Pehl M, Bauer N, Hilaire J, Levesque A, Luderer G, Schultes A, Dietrich J, Richters O (2023). _quitte: Bits and pieces of code to use with quitte-style data frames_. R package version 0.3123.0, <URL: https://github.com/pik-piam/quitte>.
Pehl M, Bauer N, Hilaire J, Levesque A, Luderer G, Schultes A, Dietrich J, Richters O (2023). _quitte: Bits and pieces of code to use with quitte-style data frames_. R package version 0.3124.0, <https://github.com/pik-piam/quitte>.

A BibTeX entry for LaTeX users is

Expand All @@ -56,7 +56,7 @@ A BibTeX entry for LaTeX users is
title = {quitte: Bits and pieces of code to use with quitte-style data frames},
author = {Michaja Pehl and Nico Bauer and Jérôme Hilaire and Antoine Levesque and Gunnar Luderer and Anselm Schultes and Jan Philipp Dietrich and Oliver Richters},
year = {2023},
note = {R package version 0.3123.0},
note = {R package version 0.3124.0},
url = {https://github.com/pik-piam/quitte},
}
```

0 comments on commit b4289f2

Please sign in to comment.