Quellcode durchsuchen

Working version

Andrej vor 1 Woche
Ursprung
Commit
37c5c4030d
7 geänderte Dateien mit 84 neuen und 5 gelöschten Zeilen
  1. BIN
      .DESCRIPTION.swp
  2. 6 5
      DESCRIPTION
  3. 2 0
      LICENSE
  4. 21 0
      LICENSE.md
  5. 1 0
      NAMESPACE
  6. 23 0
      R/modifyData.R
  7. 31 0
      man/sumWithNA.Rd

BIN
.DESCRIPTION.swp


+ 6 - 5
DESCRIPTION

@@ -1,11 +1,12 @@
 Package: rNIX
-Title: What the Package Does (One Line, Title Case)
+Title: Standard NIX tools to use with LabKey datasets
 Version: 0.0.0.9000
 Authors@R: 
-    person("First", "Last", , "first.last@example.com", role = c("aut", "cre"))
-Description: What the package does (one paragraph).
-License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a
-    license
+    person("Andrej", "Studen", , "andrej.studen@fmf.uni-lj.si", role = c("aut", "cre"))
+    person("Ana", "Lešnjak", , "iana.lesnjak@student.fmf.uni-lj.si", role = c("aut", "cre"))
+Description: Collection of standardized statistics and data adjustment tools to be used
+   with LabKey datasets. 
+License: MIT + file LICENSE
 Encoding: UTF-8
 Roxygen: list(markdown = TRUE)
 RoxygenNote: 7.3.2

+ 2 - 0
LICENSE

@@ -0,0 +1,2 @@
+YEAR: 2025
+COPYRIGHT HOLDER: rNIX authors

+ 21 - 0
LICENSE.md

@@ -0,0 +1,21 @@
+# MIT License
+
+Copyright (c) 2025 rNIX authors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 1 - 0
NAMESPACE

@@ -1,2 +1,3 @@
 # Generated by roxygen2: do not edit by hand
 
+export(sumWithNA)

+ 23 - 0
R/modifyData.R

@@ -0,0 +1,23 @@
+#' Sum columns in data frame df where some of the entries might be NA
+#'
+#' @param df data frame
+#' @param var1 first column
+#' @param var2 second column
+#' @param outVar which variable to store sum into
+#' @param valIfNA which value to use for NA
+#'
+#' @return updated data frame
+#' @export 
+#'
+## examples df<-sumWithNA(df,'lesionmtv41','metastasesmtv41','totalmtv41',0)
+
+sumWithNA<-function(df,var1='lesionmtv41',var2='metastasesmtv41',outVar='totalmtv41',valIfNA=0){
+   v1=df[,var1]
+   v2=df[,var2]
+   v1[is.na(v1)]=valIfNA
+   v2[is.na(v2)]=valIfNA
+   df[,outVar]=v1+v2
+   df
+      
+}
+

+ 31 - 0
man/sumWithNA.Rd

@@ -0,0 +1,31 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/modifyData.R
+\name{sumWithNA}
+\alias{sumWithNA}
+\title{Sum columns in data frame df where some of the entries might be NA}
+\usage{
+sumWithNA(
+  df,
+  var1 = "lesionmtv41",
+  var2 = "metastasesmtv41",
+  outVar = "totalmtv41",
+  valIfNA = 0
+)
+}
+\arguments{
+\item{df}{data frame}
+
+\item{var1}{first column}
+
+\item{var2}{second column}
+
+\item{outVar}{which variable to store sum into}
+
+\item{valIfNA}{which value to use for NA}
+}
+\value{
+updated data frame
+}
+\description{
+Sum columns in data frame df where some of the entries might be NA
+}