Commit ec27ee11 authored by levintow's avatar levintow
Browse files

updating actg repo for package

parent 6b811644
---
title: "AIDS Clinical Trial Group (ACTG) Study Dataset"
author: "Sara Levintow"
date: "8/28/2017"
output: md_document
---
# AIDS Clinical Trial Group (ACTG) Study Dataset #
The ACTG study 320 compared a combination of three antiretroviral drugs against a pair.
### Installation
You can install the package from Bitbucket
```{r setup, include=FALSE, warning=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library("devtools")
devtools::install_bitbucket("levintow/actg")
library(actg)
```
```{r, eval=FALSE}
library("devtools")
devtools::install_bitbucket("levintow/actg")
library(actg)
```
### List of Variables (variable name: definition) ###
* id: patient identifier
* male: 1=male, 0=female
* black: 1=black, 0=non-black
* hispanic: 1=hispanic, 0=non-hispanic
* idu: 1=history of injection drug use, 0=no history
* art: 1=triple therapy, 0=double therapy
* delta: 1=endpoint (AIDS or death), 0=no endpoint
* drop: 1=loss to follow up, 0=not
* r: 1=in subcohort, 0=not
* age: years of age at randomization
* karnof: Karnofsky score (100=normal, 0=dead)
* days: days from randomization to endpoint of censoring
* cd4: CD4 count in cells/mm^3 at randomization
* stop: day therapy stopped, missing if not stopped
### Notes ###
* There is one record per patient in the dataset.
* r is a constructed variable to illustrate confounding.
# AIDS Clinical Trial Group (ACTG) Study Dataset #
The ACTG study 320 compared a combination of three antiretroviral drugs against a pair.
### List of Variables (variable name: definition) ###
* id: patient identifier
* male: 1=male, 0=female
* black: 1=black, 0=non-black
* hispanic: 1=hispanic, 0=non-hispanic
* idu: 1=history of injection drug use, 0=no history
* art: 1=triple therapy, 0=double therapy
* delta: 1=endpoint (AIDS or death), 0=no endpoint
* drop: 1=loss to follow up, 0=not
* r: 1=in subcohort, 0=not
* age: years of age at randomization
* karnof: Karnofsky score (100=normal, 0=dead)
* days: days from randomization to endpoint of censoring
* cd4: CD4 count in cells/mm^3 at randomization
* stop: day therapy stopped, missing if not stopped
### Notes ###
* There is one record per patient in the dataset.
* r is a constructed variable to illustrate confounding.
AIDS Clinical Trial Group (ACTG) Study Dataset
==============================================
The ACTG study 320 compared a combination of three antiretroviral drugs
against a pair.
### Installation
You can install the package from Bitbucket
library("devtools")
devtools::install_bitbucket("levintow/actg")
library(actg)
### List of Variables (variable name: definition)
- id: patient identifier
- male: 1=male, 0=female
- black: 1=black, 0=non-black
- hispanic: 1=hispanic, 0=non-hispanic
- idu: 1=history of injection drug use, 0=no history
- art: 1=triple therapy, 0=double therapy
- delta: 1=endpoint (AIDS or death), 0=no endpoint
- drop: 1=loss to follow up, 0=not
- r: 1=in subcohort, 0=not
- age: years of age at randomization
- karnof: Karnofsky score (100=normal, 0=dead)
- days: days from randomization to endpoint of censoring
- cd4: CD4 count in cells/mm^3 at randomization
- stop: day therapy stopped, missing if not stopped
### Notes
- There is one record per patient in the dataset.
- r is a constructed variable to illustrate confounding.
# read_data.R
# Purpose: read-in ACTG data for inclusion in package
# This file is run to rebuild the actg data for the package
# Authors: Sara Levintow and Alan Brookhart
library(devtools)
library(tidyverse)
library(readr)
use_data_raw()
# Reading in ACTG data set
actg<-read.table("/Users/salevintow/Documents/R Software Development/actg/data-raw/actg320.23nov16.dat.txt")
actg<-read.table("./data-raw/actg320.23nov16.dat.txt")
colnames(actg)<-c("id","male","black","hispanic","idu","art","delta","drop","r","age","karnof","days","cd4","stop")
# Review variables and make sure data read in correctly
......@@ -14,11 +20,17 @@ actg$stop<-as.character(actg$stop)
actg$stop<-ifelse(actg$stop=="."," ",actg$stop)
actg$stop<-as.numeric(actg$stop)
## Creating event time and censoring time variables
# Creating event time and censoring time variables
actg$Y <- ifelse(actg$delta==1,actg$days,NA) #Y is time of event (AIDS or death)
actg$C <- ifelse(actg$delta==0,actg$days,NA) #C is time of censoring
actg$C1 <- ifelse(actg$drop==1,actg$days,NA) #C1 is time of censoring due to drop-out
actg$C2 <- ifelse(actg$delta==0 & actg$drop==0,actg$days,NA) #C2 is time of censoring not due to drop-out
# Exposure (idu) as a factor variable
actg$idu_f <- factor(actg$idu,levels = c(0,1), labels = c("No IDU","History of IDU"))
# Deleting indicators of outcome and drop-out
actg$delta<-NULL
actg$drop<-NULL
# Save R data set in the actg package
devtools::use_data(actg,overwrite = TRUE)
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment