Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • SIAMCAT SIAMCAT
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 13
    • Issues 13
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Zeller Group
  • SIAMCATSIAMCAT
  • Issues
  • #61

Closed
Open
Created Apr 05, 2018 by Konrad Zych@zychMaintainer0 of 2 tasks completed0/2 tasks

Use small helper function

Summary

If you are copy pasting code, it can be made into a small helper function. There are many such examples throughout you codebase, these all need to be fixed.

check_associations.r

  x.q = apply(data1, 1, function (x)quantile(x, c(0.05, 0.25, 0.5, 0.75, 0.95),
                                              na.rm=TRUE, names=FALSE))
  y.q = apply(data2, 1, function (x)quantile(x, c(0.05, 0.25, 0.5, 0.75, 0.95),
                                              na.rm=TRUE, names=FALSE))

eg: modify your function to take in a quantiles vector too, and you can reuse it accross your entire package.

apply_quantile <- function(data, quantiles_vector) {
	apply(data, 1, 
		  function (x) quantile(x, quantiles_vector,
			  na.rm = TRUE, names = FALSE))
}

Goals/sub-features

  • find this replicated code
  • replace with helper function

/cc @zych @jawirbel

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking