Commit 4af056f6 authored by levintow's avatar levintow
Browse files

adding actg repository files

parents
^.*\.Rproj$
^\.Rproj\.user$
^data-raw$
.Rproj.user
.Rhistory
.RData
.Ruserdata
Package: actg
Type: Package
Title: What the Package Does (Title Case)
Version: 0.1.0
Author: Who wrote it
Maintainer: The package maintainer <yourself@somewhere.net>
Description: More about what it does (maybe more than one line)
Use four spaces when indenting paragraphs within the Description.
License: What license is it under?
Encoding: UTF-8
LazyData: true
\ No newline at end of file
exportPattern("^[[:alpha:]]+")
# Hello, world!
#
# This is an example function named 'hello'
# which prints 'Hello, world!'.
#
# You can learn more about package authoring with RStudio at:
#
# http://r-pkgs.had.co.nz/
#
# Some useful keyboard shortcuts for package authoring:
#
# Build and Reload Package: 'Cmd + Shift + B'
# Check Package: 'Cmd + Shift + E'
# Test Package: 'Cmd + Shift + T'
hello <- function() {
print("Hello, world!")
}
library(devtools)
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")
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
str(actg)
# stop variable is currently a factor w/ 144 levels
# Need to convert to numeric and replace '.' with NA
actg$stop<-as.character(actg$stop)
actg$stop<-ifelse(actg$stop=="."," ",actg$stop)
actg$stop<-as.numeric(actg$stop)
# Save R data set in the WIHS package
devtools::use_data(actg)
# Load R data set
load(file="actg.Rda")
# Initial analyses looking at data
library(ggplot2)
library(dplyr)
library(survival)
table(actg$art,actg$delta,useNA = "always")
review<-actg %>%
group_by(art) %>%
summarize(num=n(),outcome=mean(delta),dropout=mean(drop),time=mean(days))
# Crude survival analysis
actg$SurvObj <- with(actg, Surv(days, delta == 1))
head(actg)
# Kaplan-Meier estimator
km.as.one <- survfit(SurvObj ~ 1, data = actg)
km.by.art <- survfit(SurvObj ~ art, data = actg)
# Basic plots
plot(km.as.one)
plot(km.by.art)
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
This diff is collapsed.
File added
\name{hello}
\alias{hello}
\title{Hello, World!}
\usage{
hello()
}
\description{
Prints 'Hello, world!'.
}
\examples{
hello()
}
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