df <- readRDS("C:/Users/court/Google Drive/Research/SRHS/SRHS_coded.RDS")

BUSINESS PRACTICES

 df_corr <- df %>% select(
   bp_advert_b,
   bp_screen_b,
   bp_dec_flex,
   bp_dec_standard,
   bp_dec_offer,
   bp_vouch_b,
   bp_crim_b,
   bp_dis_b,
   bp_keep_pct_num,
   bp_keep_rsn,
   bp_install_b,
   bp_comm_unit_fee_app_b,
   bp_comm_unit_fee_sec_b,
   bp_comm_unit_fee_clean_b,
   bp_comm_unit_fee_park_b,
   bp_fair,
   bp_comm_unit_fee_incl_b,
   bp_comm_unit_deposit_b,
   bp_rent_raise_b)


df_corr <- df_corr %>% rename("App fee" =   bp_comm_unit_fee_app_b,
                    "Security deposit" =    bp_comm_unit_fee_sec_b,
                    "Cleaning fee"  =   bp_comm_unit_fee_clean_b,
                    "Parking fee"   =   bp_comm_unit_fee_park_b,
                    "Advertising" = bp_advert_b,
                    "Screening" = bp_screen_b,
                    "Flexible decision" = bp_dec_flex,
                    "Standard criteria" = bp_dec_standard,
                    "Offers to nonstandard" = bp_dec_offer,
                    "Rent to vouchers" = bp_vouch_b,
                    "Rent to criminal" = bp_crim_b,
                    "Disability accom." = bp_dis_b,
                    "Deposit pct. kept" = bp_keep_pct_num,
                    "Depsoit kept reason" = bp_keep_rsn,
                    "Allow installments" = bp_install_b,
                    "Fair market price" = bp_fair,
                    "Utilities included" = bp_comm_unit_fee_incl_b,
                    "Last month required" = bp_comm_unit_deposit_b,
                    "Raised rent" = bp_rent_raise_b)
                   


df_corr1 <- df_corr %>% 
   select("Advertising",
                    "Screening",
                    "Flexible decision",
                    "Standard criteria" ,
                    "Offers to nonstandard",
                    "App fee",
                    "Security deposit",
                    "Cleaning fee",
                    "Parking fee")

df_corr2 <- df_corr %>% 
   select("Advertising",
                    "Screening",
                    "Flexible decision",
                    "Standard criteria" ,
                    "Offers to nonstandard",
                    "Rent to vouchers",
                    "Rent to criminal",
                    "Disability accom.")


df_corr3 <- df_corr %>% 
   select("App fee",
                    "Security deposit",
                    "Cleaning fee",
                    "Parking fee",
                    "Rent to vouchers",
                    "Rent to criminal",
                    "Disability accom.")

df_corr4 <- df_corr %>% 
   select("App fee",
                    "Security deposit",
                    "Cleaning fee",
                    "Parking fee",
                    "Deposit pct. kept" ,
                    "Depsoit kept reason",
                    "Allow installments",
                    "Fair market price",
                    "Utilities included",
                    "Last month required",
                    "Raised rent")

          
          
df_corr5 <- df_corr %>% 
   select("Rent to vouchers",
                    "Rent to criminal",
                    "Disability accom.",
                    "Deposit pct. kept" ,
                    "Depsoit kept reason",
                    "Allow installments",
                    "Fair market price",
                    "Utilities included",
                    "Last month required",
                    "Raised rent")

          
df_corr6 <- df_corr %>% 
   select("Advertising",
                    "Screening",
                    "Flexible decision",
                    "Standard criteria" ,
                    "Offers to nonstandard",
                    "Deposit pct. kept" ,
                    "Depsoit kept reason",
                    "Allow installments",
                    "Fair market price",
                    "Utilities included",
                    "Last month required",
                    "Raised rent")

# 
# library(ggcorrplot)
# model.matrix(~0+., data=df_corr) %>% 
#   cor(use="pairwise.complete.obs") %>% 
#   ggcorrplot(
#     show.diag = F, 
#     type="lower", 
#     lab=TRUE, 
#     lab_size=1) +
#   theme(axis.text.x = element_text(angle=90, size = 6)) +
#   theme(axis.text.y = element_text(size = 6) )
# 
library(ggcorrplot)
model.matrix(~0+., data=df_corr1) %>% 
  cor(use="pairwise.complete.obs") %>% 
  ggcorrplot(
    show.diag = F, 
    type="lower", 
    lab=TRUE, 
    lab_size=1.5) +
  theme(axis.text.x = element_text(angle=90, size = 6)) +
  theme(axis.text.y = element_text(size = 6) )
## Warning in cor(., use = "pairwise.complete.obs"): the standard deviation is zero

library(ggcorrplot)
model.matrix(~0+., data=df_corr2) %>% 
  cor(use="pairwise.complete.obs") %>% 
  ggcorrplot(
    show.diag = F, 
    type="lower", 
    lab=TRUE, 
    lab_size=1.4) +
  theme(axis.text.x = element_text(angle=90, size = 6)) +
  theme(axis.text.y = element_text(size = 6) )
## Warning in cor(., use = "pairwise.complete.obs"): the standard deviation is zero

library(ggcorrplot)
model.matrix(~0+., data=df_corr3) %>% 
  cor(use="pairwise.complete.obs") %>% 
  ggcorrplot(
    show.diag = F, 
    type="lower", 
    lab=TRUE, 
    lab_size=1.5) +
  theme(axis.text.x = element_text(angle=90, size = 6)) +
  theme(axis.text.y = element_text(size = 6) )

library(ggcorrplot)
model.matrix(~0+., data=df_corr4) %>% 
  cor(use="pairwise.complete.obs") %>% 
  ggcorrplot(
    show.diag = F, 
    type="lower", 
    lab=TRUE, 
    lab_size=1.5) +
  theme(axis.text.x = element_text(angle=90, size = 6)) +
  theme(axis.text.y = element_text(size = 6) )
## Warning in cor(., use = "pairwise.complete.obs"): the standard deviation is zero

library(ggcorrplot)
model.matrix(~0+., data=df_corr5) %>% 
  cor(use="pairwise.complete.obs") %>% 
  ggcorrplot(
    show.diag = F, 
    type="lower", 
    lab=TRUE, 
    lab_size=1.5) +
  theme(axis.text.x = element_text(angle=90, size = 6)) +
  theme(axis.text.y = element_text(size = 6) )
## Warning in cor(., use = "pairwise.complete.obs"): the standard deviation is zero

library(ggcorrplot)
model.matrix(~0+., data=df_corr6) %>% 
  cor(use="pairwise.complete.obs") %>% 
  ggcorrplot(
    show.diag = F, 
    type="lower", 
    lab=TRUE, 
    lab_size=1.5) +
  theme(axis.text.x = element_text(angle=90, size = 6)) +
  theme(axis.text.y = element_text(size = 6) )
## Warning in cor(., use = "pairwise.complete.obs"): the standard deviation is zero

corr_cross(df_corr, # name of dataset
  max_pvalue = 0.05, # display only significant correlations (at 5% level)
)
## Warning in corr_cross(df_corr, max_pvalue = 0.05, ): There are NA values in your
## data!
## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero

## Warning in cor(x, y): the standard deviation is zero
## Warning in .font_global(font, quiet = FALSE): Font 'Arial Narrow' is not
## installed, has other name, or can't be found