createRitaCephia.Rd
Get data frame using CEPHIA data for a given recency algorithm specified by the user. Optional subtype and ART exclusions.
createRitaCephia(
assays,
algorithm,
subtype = NULL,
ever_art = NULL,
filepath = NULL
)
A vector of assays to include
A function that defines the recency indicator
with arguments in the same order as the assays
vector.
Arguments do not need to have the same name as assays
.
E.g., if you have assays = c("BED", "viral_load")
,
you can have algorithm = function(b, v) ...
where b
indicates BED and v
indicates viral load.
HIV subtypes to include (one of "A1", "B", "C", "D"). By default includes everyone.
Subset data to only those who have used ARTs or have not. By default includes everyone.
Optional full filepath to downloaded CEPHIA dataset (possibly obtained via the download_cephia
).
If NULL, then uses CEPHIA version in this package.
A data frame with the following columns:
ID column (there can be multiple measurements per individual)
infection duration in days (note, if using with other functions in this package, may have to convert to years)
identified as recent based on algorithm
f <- function(b, l, v){
ifelse((b > 1 & l < 3 & !is.na(v)), 1, 0)
}
createRitaCephia(assays=c("BED", "LAg-Sedia", "viral_load"),
algorithm=f)
#> There are 53 missing values for viral_load
#> id ui ri
#> 1: 72748497 716 0
#> 2: 72748497 884 0
#> 3: 87007074 360 0
#> 4: 87007074 696 0
#> 5: 87007074 1190 0
#> ---
#> 1870: 41616271 134 0
#> 1871: 36452124 46 0
#> 1872: 43155152 114 0
#> 1873: 95702775 181 1
#> 1874: 13028433 67 0
f <- function(l, v){
v <- ifelse(l > 1.5, 0, v)
return(
ifelse((l <= 1.5) & (v > 1000), 1, 0)
)
}
test <- createRitaCephia(assays=c("LAg-Sedia", "viral_load"), algorithm=f)
#> There are 53 missing values for viral_load
#> Removing 10 observations with missing recency indicator after application of the algorithm.