Last active
February 21, 2024 22:18
-
-
Save naomispence/f67e22da2890cc6294496369892ad7b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#START BY LOADING LIBRARIES AND OPTIONS | |
library(aws.s3) | |
library(ggplot2) | |
library(dplyr) | |
library(lsr) | |
library(descr) | |
library(Hmisc) | |
library('lehmansociology') | |
options(scipen = 999) | |
#LOAD DATA FROM THE LEHMAN SERVER | |
Sys.setenv("AWS_ACCESS_KEY_ID" = "AKIAXIJLI7UET3TVMHRW", | |
"AWS_SECRET_ACCESS_KEY" = "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", | |
"AWS_DEFAULT_REGION" = "us-west-2") | |
s3load('addhealthW5.rdata', bucket = 'lehmansociologydata') | |
####FREQUENCY TABLES#### | |
#change variable names and titles | |
#CATEGORICAL VARIABLE | |
frequency(wave5addhealth$H5HR2, title= "Frequency Distribution of Living Arrangements, Wave 5 Add Health") | |
#The two lines below here RECODE the homeless and other categories to combine them to make the dummy codes consecutive. | |
wave5addhealth$H5HR2[wave5addhealth$H5HR2==5]<-4 | |
wave5addhealth$H5HR2[wave5addhealth$H5HR2==6]<-4 | |
#The 3 lines below here LABEL the dummy codes as the categories that they represent after I RECODED | |
wave5addhealth$H5HR2 <- factor(wave5addhealth$H5HR2, levels = c(1,2,3,4), | |
labels = c("Own Place", "Parents' Home", "Another Person's Home","Other")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment