Skip to content

Commit

Permalink
Merge pull request #35 from jasenfinch/devel
Browse files Browse the repository at this point in the history
v0.5.7
  • Loading branch information
jasenfinch committed Sep 27, 2021
2 parents 6bb010c + d358221 commit 61fdebf
Show file tree
Hide file tree
Showing 28 changed files with 293 additions and 34 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: metaboMisc
Title: Miscellaneous Functions for Metabolomics Analyses
Version: 0.5.6
Version: 0.5.7
Authors@R: person("Jasen", "Finch", email = "jsf9@aber.ac.uk", role = c("aut", "cre"))
Description: Miscellaneous helper functions for metabolomics analyses that do not yet have a permanent home.
URL: https://jasenfinch.github.io/metaboMisc
Expand Down Expand Up @@ -42,5 +42,4 @@ Remotes: aberHRML/binneR,
jasenfinch/metabolyseR,
jasenfinch/profilePro,
jasenfinch/MFassign,
aberHRML/metaboData,
jasenfinch/grover
2 changes: 2 additions & 0 deletions NAMESPACE
Expand Up @@ -22,6 +22,7 @@ export(exportSummarisedAssignments)
export(featureSummary)
export(preTreatModes)
export(reduce)
export(sanitiseTable)
export(suitableParallelPlan)
exportMethods(plotRSD)
importFrom(MFassign,assignedData)
Expand All @@ -42,6 +43,7 @@ importFrom(dplyr,filter)
importFrom(dplyr,group_by)
importFrom(dplyr,group_by_all)
importFrom(dplyr,mutate)
importFrom(dplyr,mutate_if)
importFrom(dplyr,n)
importFrom(dplyr,n_distinct)
importFrom(dplyr,rename)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
@@ -1,3 +1,9 @@
# metaboMisc 0.5.7

* Removed `aberHRML/metaboData` from the Remotes field in the DESCRIPTION to ensure that the CRAN version of metaboData is installed.

* Added `sanitiseTable()` that can be used to restrict the number of rows in a table and round numeric columns to a given number of significant figures.

# metaboMisc 0.5.6

* Fixed missing argument error in `detectPretreatmentParameters()` when miss injections are detected.
Expand Down
21 changes: 21 additions & 0 deletions R/sanitise.R
@@ -0,0 +1,21 @@
#' Sanitise a data table
#' @description Sanitise a data table by restricting the number of rows and rounding numeric columns.
#' @param x A tibble or data.frame containing the data to be sanitised
#' @param maxRows Maximum number of rows with which to restrict the table
#' @param sigFig Significant figures with which to round numeric columns
#' @examples
#' sanitiseTable(iris,maxRows = 10,sigFig = 1)
#' @importFrom dplyr mutate_if
#' @export


sanitiseTable <- function(x,maxRows = 5000,sigFig = 3){
x <- mutate_if(x,is.numeric,signif,digits = sigFig)

if (nrow(x) > maxRows){
message(str_c('Number of rows in table restricted to ',maxRows,'.'))
x <- x[seq_len(maxRows),]
}

return(x)
}
2 changes: 1 addition & 1 deletion docs/404.html

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

2 changes: 1 addition & 1 deletion docs/authors.html

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

2 changes: 1 addition & 1 deletion docs/index.html

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

10 changes: 9 additions & 1 deletion docs/news/index.html

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

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Expand Up @@ -2,7 +2,7 @@ pandoc: 2.11.4
pkgdown: 1.6.1
pkgdown_sha: ~
articles: {}
last_built: 2021-09-21T08:03Z
last_built: 2021-09-27T10:19Z
urls:
reference: https://jasenfinch.github.io/metaboMisc//reference
article: https://jasenfinch.github.io/metaboMisc//articles
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/addAssignments.html

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

2 changes: 1 addition & 1 deletion docs/reference/convertSampleInfo.html

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

4 changes: 2 additions & 2 deletions docs/reference/detectBatchDiff.html

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

4 changes: 2 additions & 2 deletions docs/reference/detectMissInjections.html

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

4 changes: 2 additions & 2 deletions docs/reference/detectModellingParameters.html

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

0 comments on commit 61fdebf

Please sign in to comment.