this functions takes covariate data and a cohort/population and remaps the covariate and row ids, restricts to pop and saves/creates mapping
Examples
covariateData <- Andromeda::andromeda(
covariates = data.frame(rowId = c(1, 3, 5, 7, 9),
covariateId = c(10, 20, 10, 10, 20),
covariateValue = c(1, 1, 1, 1, 1)),
covariateRef = data.frame(covariateId = c(10, 20),
covariateNames = c("covariateA",
"covariateB"),
analysisId = c(1, 1)))
mappedData <- MapIds(covariateData)
#> starting to map the columns and rows
#> finished MapCovariates
# columnId and rowId are now starting from 1 and are consecutive
mappedData$covariates
#> # Source: table<`covariates`> [?? x 4]
#> # Database: sqlite 3.47.1 [/tmp/RtmpPJeNgk/file20b122df1cce.sqlite]
#> covariateId covariateValue columnId rowId
#> <dbl> <dbl> <int> <int>
#> 1 10 1 1 1
#> 2 20 1 2 2
#> 3 10 1 1 3
#> 4 10 1 1 4
#> 5 20 1 2 5