Main dataset
Size of the dataset in rows, columns
dim(df) #check size of the dataset rows, columns
[1] 2138 445
#df$ID<-seq.int(nrow(df)) # create an ID for every person
3_Pain_or_other_dental_disorders_in_last_12_months4_Frequency_of_dentist_visits_in_last_12_months5_Reason_to_attend_dentist6Public_or_privat_dentist7_Frequency_of_dental_hygienist_visits8_Frequency_of_toothbrushing9_Usage_of_toothpaste9_Usage_of_toothbrush9_Usage_of_dental_floss9_Usage_of_tooth_picks9_Usage_of_mouth_wash9Usage_of_tounge_cleaner9_Usage_of_other_hygiene_appliance10_Fluoride_in_toothpaste11_Usage_of_fluoride_supplements12_Selfevaluated_oral_hygiene_care13_Eating_habits_grouped14_Sweet_yogurt_weekly14_Sweet_milk_weekly14_Sweet_creams_weekly14_Karums_weekly14_Bread_weekly14_Cornflakes_not_sweetened_weekly14_Canned_fruits_weekly14_Dried_fruits_weekly14_Juice_or_soft_drinks_weekly14_Tee_cacao_or_coffee_with_sugar_weekly14_Marmelade_honey_syrup_or_other_sweet_souce_weekly14_Ice_cream_weekly14_Cookies_or_wafles_weekly14_Chocolate_or_chocolate_bars_weekly14_Musli_bars_weekly14_Chocolate_candies_weekly14Caramel_weekly14_Fresh_breath_dragees_weekly14_Chupa-chups_or_similar_candy_weekly14_Toffies_or_chewing_candies_weekly14_Potato_chips_or_salty_cookies_weekly14_Sweet_popcorn_weekly14_Chewing_gum_with_sugar_weekly14_Sugarfree_chewing_gum_weekly151_Cups_of_tee_daily152_Cups_of_cacao_daily153_Cups_of_coffee_daily161_Tsp_sugar_for_one_tee162_Tsp_sugar_for_one_cacao163_Tsp_sugar_for_one_coffee17_Selfevaluated_dietary_habits18_Frequency_of_smoking19_Tobacco_usage_(not_smoking)_in_last_30_days20_Own_toothbrushrequire("tidyverse")
require("lubridate") #for dates
require("tables")
library(foreign)
require(stargazer)
Data in https://docs.google.com/spreadsheets/d/154tcURPHwgmGcmndhQyEIT_dLzmbA_ZPSAKZTwHyGgw/edit?usp=sharing
Size of the dataset in rows, columns
dim(df) #check size of the dataset rows, columns
[1] 2138 445
#df$ID<-seq.int(nrow(df)) # create an ID for every person
Unselect the kappa dataset
#df <- df %>%
# filter(`3d_Examination_time_(forst_or_second)` !=2)
#dim(df) #check size of the dataset. 222 observations removed. Original dataset 2904
Fix dates and create a new variable age
#df$`2_Examination_date`<- as.Date(df$`2_Examination_date`, format = "%m/%d/%Y")
#df$`4_Birth_date` <- as.Date(df$`4_Birth_date`, format = "%m/%d/%Y")
#df <- df %>%
# mutate(Age = as.integer(difftime(as.Date(`2_Examination_date`), as.Date(`4_Birth_date`),
# unit="weeks"))/52.25)
Fix NA in gender
#df$`1_gender`[is.na(df$`1_gender`)] <- "M"
Select only the age = 12. Verify, must be 2138 update 2163
dim(df)
[1] 1725 444
df$`23Cars_in_family`[df$`23Cars_in_family` == "No"] <- 0
There were 17 warnings (use warnings() to see them)
df$`23Cars_in_family`[df$`23Cars_in_family` == "One"] <- 1
df$`23Cars_in_family`[df$`23Cars_in_family` == "Two or more"] <- 2
df$`24Existance_of_own_room`[df$`24Existance_of_own_room` == "No"] <- 0
df$`24Existance_of_own_room`[df$`24Existance_of_own_room` == "Yes"] <- 1
df$`25Number_of_computers_in_family`[df$`25Number_of_computers_in_family` == "Noone"] <- 0
df$`25Number_of_computers_in_family`[df$`25Number_of_computers_in_family` == "One"] <- 1
df$`25Number_of_computers_in_family`[df$`25Number_of_computers_in_family` == "Two"] <- 2
df$`25Number_of_computers_in_family`[df$`25Number_of_computers_in_family` == "More tham two"] <- 3
df$`27_Frequency_of_travels_in_abroad_in_last_12_months_with_family`[df$`27_Frequency_of_travels_in_abroad_in_last_12_months_with_family` == "Noone" ] <- 0
df$`27_Frequency_of_travels_in_abroad_in_last_12_months_with_family`[df$`27_Frequency_of_travels_in_abroad_in_last_12_months_with_family` == "One time" ] <- 1
df$`27_Frequency_of_travels_in_abroad_in_last_12_months_with_family`[df$`27_Frequency_of_travels_in_abroad_in_last_12_months_with_family` == "Two times" ] <- 2
df$`27_Frequency_of_travels_in_abroad_in_last_12_months_with_family`[df$`27_Frequency_of_travels_in_abroad_in_last_12_months_with_family` == "More than two times" ] <- 3
df$`26_Number_of_bathrooms_at_home`[df$`26_Number_of_bathrooms_at_home` == "Noone"] <- 0
df$`26_Number_of_bathrooms_at_home`[df$`26_Number_of_bathrooms_at_home` == "One"] <- 1
df$`26_Number_of_bathrooms_at_home`[df$`26_Number_of_bathrooms_at_home` == "Two"] <- 2
df$`26_Number_of_bathrooms_at_home`[df$`26_Number_of_bathrooms_at_home` == "More than two"] <- 3
df$`24Existance_of_own_room` <- as.integer(df$`24Existance_of_own_room`)
df$`25Number_of_computers_in_family` <- as.integer(df$`25Number_of_computers_in_family`)
df$`27_Frequency_of_travels_in_abroad_in_last_12_months_with_family` <- as.integer(df$`27_Frequency_of_travels_in_abroad_in_last_12_months_with_family`)
df$`23Cars_in_family` <- as.integer(df$`23Cars_in_family`)
df$`26_Number_of_bathrooms_at_home` <- as.integer(df$`26_Number_of_bathrooms_at_home`)
df <- df %>%
mutate(FAS =
`23Cars_in_family` +
`24Existance_of_own_room` +
`25Number_of_computers_in_family` +
`27_Frequency_of_travels_in_abroad_in_last_12_months_with_family` +
`26_Number_of_bathrooms_at_home` ) %>%
mutate(FAS_cat = ifelse( FAS >= 9, "High affluence",
ifelse( FAS <= 4 , "Low affluence",
"Middle affluence")))
df$FAS_cat <- ordered(df$FAS_cat,
levels = c(
"High affluence",
"Middle affluence",
"Low affluence"
))
Give order to factors
Create new variables for school and region
df <- df %>%
rename(RegionsKods = `3a_Region`) %>%
rename(SkolasKods = `3b_School` )
Error: Unknown variables: 3a_Region.
subset 2138
# df<- sample_n(df, 2138) # Not use with df_final_dec12_2016.csv
# write.csv(df, "df_final_dec12_2016.csv")
Summary: Dataset = 2904 records Dataset without kappa 2 = 2682 records Dataset only age = 12 = 2138
Dataset clean and ready for analysis
addmargins(table(df$`1_gender`))
ggplot(df, aes(`1_gender`)) + geom_bar() + theme_minimal()
df %>%
group_by(SkolaName, `1_gender`) %>%
summarise(n=n()) %>%
spread( `1_gender`, n) %>%
write.csv(,file = "./tables/SkolaDzimuns.csv")
df %>%
group_by(SkolaName, `1_gender`) %>%
summarise(n=n()) %>%
spread( `1_gender`, n) %>%
ungroup()
df %>%
group_by(SkolaName, RegionName) %>%
summarise(n=n()) %>%
spread(RegionName, n) %>%
write.csv(,file = "./tables/SkolaRegion.csv")
df %>%
group_by(SkolaName, RegionName) %>%
summarise(n=n()) %>%
spread(RegionName, n) %>%
ungroup()
tb <- table(df$SkolaName, df$RegionName)
write.table(tb, file = "./tables/Table school and region.csv", sep = ";", row.names = T, col.names = T); rm(tb)
df %>%
group_by(FAS_cat) %>%
summarise(n())
df %>%
group_by(FAS_cat) %>%
summarise(n()) %>%
write.csv(,file = "./tables/FAS.csv")
df %>%
group_by(FAS_cat, `1_gender`) %>%
summarise(n=n()) %>%
spread(FAS_cat, n)
df %>%
group_by(FAS_cat, `1_gender`) %>%
summarise(n=n()) %>%
spread(FAS_cat, n) %>%
write.csv(,file = "./tables/FAS_gender.csv")
addmargins(table(df$`1_gender`, df$FAS_cat))
df %>%
group_by(FAS_cat, `RegionName`) %>%
summarise(n=n()) %>%
spread(FAS_cat, n)
write.table(addmargins(table(df$RegionName, df$FAS_cat)), "./tables/fas_region.csv")
df %>%
group_by(FAS_cat, `2_Live_in`) %>%
summarise(n = n()) %>%
spread(FAS_cat, n, fill = 0)
df %>%
group_by(FAS_cat, `2_Live_in`) %>%
summarise(n = n()) %>%
spread(FAS_cat, n, fill = 0) %>%
write.csv(,file = "./tables/FAS_Live_in.csv")
df %>%
group_by(`FAS_cat` , `22_Average_pocket_money`) %>%
summarise(n= n()) %>%
spread(`FAS_cat`, n)
df %>%
group_by(`FAS_cat` , `22_Average_pocket_money`) %>%
summarise(n= n()) %>%
spread(`FAS_cat`, n) %>%
write.csv(,file = "./tables/FAS_pocketMoney.csv")
3_Pain_or_other_dental_disorders_in_last_12_monthsdf %>%
group_by(`1_gender`, `3_Pain_or_other_dental_disorders_in_last_12_months`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`3_Pain_or_other_dental_disorders_in_last_12_months`, n, fill=0)
df %>%
group_by(`2_Live_in`, `3_Pain_or_other_dental_disorders_in_last_12_months`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`3_Pain_or_other_dental_disorders_in_last_12_months`, n, fill=0)
df %>%
group_by(`RegionName`, `3_Pain_or_other_dental_disorders_in_last_12_months`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`3_Pain_or_other_dental_disorders_in_last_12_months`, n, fill=0)
df %>%
group_by(`1_gender`, `3_Pain_or_other_dental_disorders_in_last_12_months`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`3_Pain_or_other_dental_disorders_in_last_12_months`, n, fill=0) %>%
write.csv(,file = "./tables/3_Pain_or_in_x_gender.csv")
df %>%
group_by(`2_Live_in`, `3_Pain_or_other_dental_disorders_in_last_12_months`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`3_Pain_or_other_dental_disorders_in_last_12_months`, n, fill=0) %>%
write.csv(,file = "./tables/3_Pain_or_in_x_Live_in.csv")
df %>%
group_by(`RegionName`, `3_Pain_or_other_dental_disorders_in_last_12_months`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`3_Pain_or_other_dental_disorders_in_last_12_months`, n, fill=0) %>%
write.csv(,file = "./tables/3_Pain_or_in_x_region.csv")
chisq.test(table(df$`1_gender`, df$`3_Pain_or_other_dental_disorders_in_last_12_months`)) # only with gender, since some regions and cities have 0
4_Frequency_of_dentist_visits_in_last_12_monthsdf %>%
group_by(`1_gender`, `4_Frequency_of_dentist_visits_in_last_12_months`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`4_Frequency_of_dentist_visits_in_last_12_months`, n, fill=0)
df %>%
group_by(`2_Live_in`, `4_Frequency_of_dentist_visits_in_last_12_months`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`4_Frequency_of_dentist_visits_in_last_12_months`, n, fill=0)
df %>%
group_by(`RegionName`, `4_Frequency_of_dentist_visits_in_last_12_months`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`4_Frequency_of_dentist_visits_in_last_12_months`, n, fill=0)
df %>%
group_by(`1_gender`, `4_Frequency_of_dentist_visits_in_last_12_months`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`4_Frequency_of_dentist_visits_in_last_12_months`, n, fill=0) %>%
write.csv(,file = "./tables/4_Frequency_of_dentist_visits_x_gender.csv")
df %>%
group_by(`2_Live_in`, `4_Frequency_of_dentist_visits_in_last_12_months`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`4_Frequency_of_dentist_visits_in_last_12_months`, n, fill=0) %>%
write.csv(,file = "./tables/4_Frequency_of_dentist_visitsn_x_Live_in.csv")
df %>%
group_by(`RegionName`, `4_Frequency_of_dentist_visits_in_last_12_months`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`4_Frequency_of_dentist_visits_in_last_12_months`, n, fill=0) %>%
write.csv(,file = "./tables/4_Frequency_of_dentist_visits_in_x_region.csv")
5_Reason_to_attend_dentistdf %>%
group_by(`1_gender`, `5_Reason_to_attend_dentist`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`5_Reason_to_attend_dentist`, n, fill=0)
df %>%
group_by(`2_Live_in`, `5_Reason_to_attend_dentist`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`5_Reason_to_attend_dentist`, n, fill=0)
df %>%
group_by(`RegionName`, `5_Reason_to_attend_dentist`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`5_Reason_to_attend_dentist`, n, fill=0)
df %>%
group_by(`1_gender`, `5_Reason_to_attend_dentist`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`5_Reason_to_attend_dentist`, n, fill=0) %>%
write.csv(,file = "./tables/5_Reason_to_attend_dentist_x_gender.csv")
df %>%
group_by(`2_Live_in`, `5_Reason_to_attend_dentist`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`5_Reason_to_attend_dentist`, n, fill=0) %>%
write.csv(,file = "./tables/5_Reason_to_attend_dentist_x_Live_in.csv")
df %>%
group_by(`RegionName`, `5_Reason_to_attend_dentist`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`5_Reason_to_attend_dentist`, n, fill=0) %>%
write.csv(,file = "./tables/5_Reason_to_attend_dentist_in_x_region.csv")
chisq.test(table(df$`1_gender`, df$`5_Reason_to_attend_dentist`)) # only with gender, since some regions and cities have 0
6Public_or_privat_dentistdf %>%
group_by(`1_gender`, `6Public_or_privat_dentist`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`6Public_or_privat_dentist`, n, fill=0)
df %>%
group_by(`2_Live_in`, `6Public_or_privat_dentist`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`6Public_or_privat_dentist`, n, fill=0)
df %>%
group_by(`RegionName`, `6Public_or_privat_dentist`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`6Public_or_privat_dentist`, n, fill=0)
df %>%
group_by(`1_gender`, `6Public_or_privat_dentist`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`6Public_or_privat_dentist`, n, fill=0) %>%
write.csv(,file = "./tables/6Public_or_privat_dentist_x_gender.csv")
df %>%
group_by(`2_Live_in`, `6Public_or_privat_dentist`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`6Public_or_privat_dentist`, n, fill=0) %>%
write.csv(,file = "./tables/6Public_or_privat_dentist_x_Live_in.csv")
df %>%
group_by(`RegionName`, `6Public_or_privat_dentist`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`6Public_or_privat_dentist`, n, fill=0) %>%
write.csv(,file = "./tables/6Public_or_privat_dentist_in_x_region.csv")
chisq.test(table(df$`1_gender`, df$`6Public_or_privat_dentist`)) # only with gender, since some regions and cities have 0
7_Frequency_of_dental_hygienist_visitsdf %>%
group_by(`1_gender`, `7_Frequency_of_dental_hygienist_visits`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`7_Frequency_of_dental_hygienist_visits`, n, fill=0)
df %>%
group_by(`2_Live_in`, `7_Frequency_of_dental_hygienist_visits`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`7_Frequency_of_dental_hygienist_visits`, n, fill=0)
df %>%
group_by(`RegionName`, `7_Frequency_of_dental_hygienist_visits`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`7_Frequency_of_dental_hygienist_visits`, n, fill=0)
df %>%
group_by(`1_gender`, `7_Frequency_of_dental_hygienist_visits`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`7_Frequency_of_dental_hygienist_visits`, n, fill=0) %>%
write.csv(,file = "./tables/7_Frequency_of_dental_hygienist_visits_x_gender.csv")
df %>%
group_by(`2_Live_in`, `7_Frequency_of_dental_hygienist_visits`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`7_Frequency_of_dental_hygienist_visits`, n, fill=0) %>%
write.csv(,file = "./tables/7_Frequency_of_dental_hygienist_visits_x_Live_in.csv")
df %>%
group_by(`RegionName`, `7_Frequency_of_dental_hygienist_visits`) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`7_Frequency_of_dental_hygienist_visits`, n, fill=0) %>%
write.csv(,file = "./tables/7_Frequency_of_dental_hygienist_visits_in_x_region.csv")
chisq.test(table(df$`1_gender`, df$`7_Frequency_of_dental_hygienist_visits`)) # only with gender, since some regions and cities have 0
8_Frequency_of_toothbrushingdf %>%
group_by(`1_gender`, `8_Frequency_of_toothbrushing` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`8_Frequency_of_toothbrushing` , n, fill=0)
df %>%
group_by(`2_Live_in`, `8_Frequency_of_toothbrushing` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`8_Frequency_of_toothbrushing` , n, fill=0)
df %>%
group_by(`RegionName`, `8_Frequency_of_toothbrushing` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`8_Frequency_of_toothbrushing` , n, fill=0)
df %>%
group_by(`1_gender`, `8_Frequency_of_toothbrushing` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`8_Frequency_of_toothbrushing` , n, fill=0) %>%
write.csv(,file = "./tables/8_Frequency_of_toothbrushing_x_gender.csv")
df %>%
group_by(`2_Live_in`, `8_Frequency_of_toothbrushing` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`8_Frequency_of_toothbrushing` , n, fill=0) %>%
write.csv(,file = "./tables/8_Frequency_of_toothbrushing_x_Live_in.csv")
df %>%
group_by(`RegionName`, `8_Frequency_of_toothbrushing` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`8_Frequency_of_toothbrushing` , n, fill=0) %>%
write.csv(,file = "./tables/8_Frequency_of_toothbrushing_x_region.csv")
chisq.test(table(df$`1_gender`, df$`8_Frequency_of_toothbrushing` )) # only with gender, since some regions and cities have 0
9_Usage_of_toothpastedf %>%
group_by(`1_gender`, `9_Usage_of_toothpaste` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_toothpaste` , n, fill=0)
df %>%
group_by(`2_Live_in`, `9_Usage_of_toothpaste` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_toothpaste` , n, fill=0)
df %>%
group_by(`RegionName`, `9_Usage_of_toothpaste` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_toothpaste` , n, fill=0)
df %>%
group_by(`1_gender`, `9_Usage_of_toothpaste` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_toothpaste` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_toothpaste_x_gender.csv")
df %>%
group_by(`2_Live_in`, `9_Usage_of_toothpaste` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_toothpaste` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_toothpaste_x_Live_in.csv")
df %>%
group_by(`RegionName`, `9_Usage_of_toothpaste` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_toothpaste` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_toothpaste_x_region.csv")
chisq.test(table(df$`1_gender`, df$`9_Usage_of_toothpaste` )) # only with gender, since some regions and cities have 0
9_Usage_of_toothbrushdf %>%
group_by(`1_gender`, `9_Usage_of_toothbrush` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_toothbrush` , n, fill=0)
df %>%
group_by(`2_Live_in`, `9_Usage_of_toothbrush` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_toothbrush` , n, fill=0)
df %>%
group_by(`RegionName`, `9_Usage_of_toothbrush` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_toothbrush` , n, fill=0)
df %>%
group_by(`1_gender`, `9_Usage_of_toothbrush` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_toothbrush` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_toothbrush_x_gender.csv")
df %>%
group_by(`2_Live_in`, `9_Usage_of_toothbrush` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_toothbrush` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_toothbrush_x_Live_in.csv")
df %>%
group_by(`RegionName`, `9_Usage_of_toothbrush` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_toothbrush` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_toothbrush_x_region.csv")
chisq.test(table(df$`1_gender`, df$`9_Usage_of_toothbrush` )) # only with gender, since some regions and cities have 0
9_Usage_of_dental_flossdf %>%
group_by(`1_gender`, `9_Usage_of_dental_floss` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_dental_floss` , n, fill=0)
df %>%
group_by(`2_Live_in`, `9_Usage_of_dental_floss` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_dental_floss` , n, fill=0)
df %>%
group_by(`RegionName`, `9_Usage_of_dental_floss` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_dental_floss` , n, fill=0)
df %>%
group_by(`1_gender`, `9_Usage_of_dental_floss` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_dental_floss` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_dental_floss_x_gender.csv")
df %>%
group_by(`2_Live_in`, `9_Usage_of_dental_floss` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_dental_floss` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_dental_floss`_x_Live_in.csv")
df %>%
group_by(`RegionName`, `9_Usage_of_dental_floss` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_dental_floss` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_dental_floss_x_region.csv")
chisq.test(table(df$`1_gender`, df$`9_Usage_of_dental_floss` )) # only with gender, since some regions and cities have 0
9_Usage_of_tooth_picksdf %>%
group_by(`1_gender`, `9_Usage_of_tooth_picks` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_tooth_picks` , n, fill=0)
df %>%
group_by(`2_Live_in`, `9_Usage_of_tooth_picks` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_tooth_picks` , n, fill=0)
df %>%
group_by(`RegionName`, `9_Usage_of_tooth_picks` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_tooth_picks` , n, fill=0)
df %>%
group_by(`1_gender`, `9_Usage_of_tooth_picks` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_tooth_picks` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_tooth_picks_x_gender.csv")
df %>%
group_by(`2_Live_in`, `9_Usage_of_tooth_picks` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_tooth_picks` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_tooth_picks_x_Live_in.csv")
df %>%
group_by(`RegionName`, `9_Usage_of_tooth_picks` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_tooth_picks` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_tooth_picks_x_region.csv")
chisq.test(table(df$`1_gender`, df$`9_Usage_of_tooth_picks` )) # only with gender, since some regions and cities have 0
9_Usage_of_mouth_washdf %>%
group_by(`1_gender`, `9_Usage_of_mouth_wash` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_mouth_wash` , n, fill=0)
df %>%
group_by(`2_Live_in`, `9_Usage_of_mouth_wash` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_mouth_wash` , n, fill=0)
df %>%
group_by(`RegionName`, `9_Usage_of_mouth_wash` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_mouth_wash` , n, fill=0)
df %>%
group_by(`1_gender`, `9_Usage_of_mouth_wash` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_mouth_wash` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_mouth_wash_x_gender.csv")
df %>%
group_by(`2_Live_in`, `9_Usage_of_mouth_wash` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_mouth_wash` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_mouth_wash_x_Live_in.csv")
df %>%
group_by(`RegionName`, `9_Usage_of_mouth_wash` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_mouth_wash` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_mouth_wash_x_region.csv")
chisq.test(table(df$`1_gender`, df$`9_Usage_of_mouth_wash` )) # only with gender, since some regions and cities have 0
9Usage_of_tounge_cleanerdf %>%
group_by(`1_gender`, `9Usage_of_tounge_cleaner` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9Usage_of_tounge_cleaner` , n, fill=0)
df %>%
group_by(`2_Live_in`, `9Usage_of_tounge_cleaner` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9Usage_of_tounge_cleaner` , n, fill=0)
df %>%
group_by(`RegionName`, `9Usage_of_tounge_cleaner` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9Usage_of_tounge_cleaner` , n, fill=0)
df %>%
group_by(`1_gender`, `9Usage_of_tounge_cleaner` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9Usage_of_tounge_cleaner` , n, fill=0) %>%
write.csv(,file = "./tables/9Usage_of_tounge_cleaner_x_gender.csv")
df %>%
group_by(`2_Live_in`, `9Usage_of_tounge_cleaner` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9Usage_of_tounge_cleaner` , n, fill=0) %>%
write.csv(,file = "./tables/9Usage_of_tounge_cleaner_x_Live_in.csv")
df %>%
group_by(`RegionName`, `9Usage_of_tounge_cleaner` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9Usage_of_tounge_cleaner` , n, fill=0) %>%
write.csv(,file = "./tables/9Usage_of_tounge_cleaner_x_region.csv")
chisq.test(table(df$`1_gender`, df$`9Usage_of_tounge_cleaner` )) # only with gender, since some regions and cities have 0
9_Usage_of_other_hygiene_appliancedf %>%
group_by(`1_gender`, `9_Usage_of_other_hygiene_appliance` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_other_hygiene_appliance` , n, fill=0)
df %>%
group_by(`2_Live_in`, `9_Usage_of_other_hygiene_appliance` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_other_hygiene_appliance` , n, fill=0)
df %>%
group_by(`RegionName`, `9_Usage_of_other_hygiene_appliance` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_other_hygiene_appliance` , n, fill=0)
df %>%
group_by(`1_gender`, `9_Usage_of_other_hygiene_appliance` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_other_hygiene_appliance` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_other_hygiene_appliance_x_gender.csv")
df %>%
group_by(`2_Live_in`, `9_Usage_of_other_hygiene_appliance` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_other_hygiene_appliance` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_other_hygiene_appliance_x_Live_in.csv")
df %>%
group_by(`RegionName`, `9_Usage_of_other_hygiene_appliance` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`9_Usage_of_other_hygiene_appliance` , n, fill=0) %>%
write.csv(,file = "./tables/9_Usage_of_other_hygiene_appliance_x_region.csv")
chisq.test(table(df$`1_gender`, df$`9Usage_of_tounge_cleaner` )) # only with gender, since some regions and cities have 0
10_Fluoride_in_toothpastedf %>%
group_by(`1_gender`, `10_Fluoride_in_toothpaste` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`10_Fluoride_in_toothpaste` , n, fill=0)
df %>%
group_by(`2_Live_in`, `10_Fluoride_in_toothpaste` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`10_Fluoride_in_toothpaste` , n, fill=0)
df %>%
group_by(`RegionName`, `10_Fluoride_in_toothpaste` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`10_Fluoride_in_toothpaste` , n, fill=0)
df %>%
group_by(`1_gender`, `10_Fluoride_in_toothpaste` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`10_Fluoride_in_toothpaste` , n, fill=0) %>%
write.csv(,file = "./tables/10_Fluoride_in_toothpaste_x_gender.csv")
df %>%
group_by(`2_Live_in`, `10_Fluoride_in_toothpaste` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`10_Fluoride_in_toothpaste` , n, fill=0) %>%
write.csv(,file = "./tables/10_Fluoride_in_toothpaste_x_Live_in.csv")
df %>%
group_by(`RegionName`, `10_Fluoride_in_toothpaste` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`10_Fluoride_in_toothpaste` , n, fill=0) %>%
write.csv(,file = "./tables/10_Fluoride_in_toothpaste_x_region.csv")
chisq.test(table(df$`1_gender`, df$`10_Fluoride_in_toothpaste` )) # only with gender, since some regions and cities have 0
11_Usage_of_fluoride_supplementsdf %>%
group_by(`1_gender`, `11_Usage_of_fluoride_supplements` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`11_Usage_of_fluoride_supplements` , n, fill=0)
df %>%
group_by(`2_Live_in`, `11_Usage_of_fluoride_supplements` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`11_Usage_of_fluoride_supplements` , n, fill=0)
df %>%
group_by(`RegionName`, `11_Usage_of_fluoride_supplements` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`11_Usage_of_fluoride_supplements` , n, fill=0)
df %>%
group_by(`1_gender`, `11_Usage_of_fluoride_supplements` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`11_Usage_of_fluoride_supplements` , n, fill=0) %>%
write.csv(,file = "./tables/11_Usage_of_fluoride_supplements_x_gender.csv")
df %>%
group_by(`2_Live_in`, `11_Usage_of_fluoride_supplements` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`11_Usage_of_fluoride_supplements` , n, fill=0) %>%
write.csv(,file = "./tables/11_Usage_of_fluoride_supplements_x_Live_in.csv")
df %>%
group_by(`RegionName`, `11_Usage_of_fluoride_supplements` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`11_Usage_of_fluoride_supplements` , n, fill=0) %>%
write.csv(,file = "./tables/11_Usage_of_fluoride_supplements_x_region.csv")
chisq.test(table(df$`1_gender`, df$`11_Usage_of_fluoride_supplements` )) # only with gender, since some regions and cities have 0
12_Selfevaluated_oral_hygiene_caredf %>%
group_by(`1_gender`, `12_Selfevaluated_oral_hygiene_care` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`12_Selfevaluated_oral_hygiene_care` , n, fill=0)
df %>%
group_by(`2_Live_in`, `12_Selfevaluated_oral_hygiene_care` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`12_Selfevaluated_oral_hygiene_care` , n, fill=0)
df %>%
group_by(`RegionName`, `12_Selfevaluated_oral_hygiene_care` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`12_Selfevaluated_oral_hygiene_care` , n, fill=0)
df %>%
group_by(`1_gender`, `12_Selfevaluated_oral_hygiene_care` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`12_Selfevaluated_oral_hygiene_care` , n, fill=0) %>%
write.csv(,file = "./tables/12_Selfevaluated_oral_hygiene_care_x_gender.csv")
df %>%
group_by(`2_Live_in`, `12_Selfevaluated_oral_hygiene_care` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`12_Selfevaluated_oral_hygiene_care` , n, fill=0) %>%
write.csv(,file = "./tables/12_Selfevaluated_oral_hygiene_care_x_Live_in.csv")
df %>%
group_by(`RegionName`, `12_Selfevaluated_oral_hygiene_care` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`12_Selfevaluated_oral_hygiene_care` , n, fill=0) %>%
write.csv(,file = "./tables/12_Selfevaluated_oral_hygiene_care_x_region.csv")
chisq.test(table(df$`1_gender`, df$`11_Usage_of_fluoride_supplements` )) # only with gender, since some regions and cities have 0
13_Eating_habits_groupeddf %>%
group_by(`1_gender`, `13_Eating_habits_grouped` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`13_Eating_habits_grouped` , n, fill=0)
df %>%
group_by(`2_Live_in`, `13_Eating_habits_grouped` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`13_Eating_habits_grouped` , n, fill=0)
df %>%
group_by(`RegionName`, `13_Eating_habits_grouped` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`13_Eating_habits_grouped` , n, fill=0)
df %>%
group_by(`1_gender`, `13_Eating_habits_grouped` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`13_Eating_habits_grouped` , n, fill=0) %>%
write.csv(,file = "./tables/13_Eating_habits_grouped_x_gender.csv")
df %>%
group_by(`2_Live_in`, `13_Eating_habits_grouped` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`13_Eating_habits_grouped` , n, fill=0) %>%
write.csv(,file = "./tables/13_Eating_habits_grouped_x_Live_in.csv")
df %>%
group_by(`RegionName`, `13_Eating_habits_grouped` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`13_Eating_habits_grouped` , n, fill=0) %>%
write.csv(,file = "./tables/13_Eating_habits_grouped_x_region.csv")
chisq.test(table(df$`1_gender`, df$`13_Eating_habits_grouped` )) # only with gender, since some regions and cities have 0
14_Sweet_yogurt_weeklydf %>%
group_by(`1_gender`, `14_Sweet_yogurt_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_yogurt_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Sweet_yogurt_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_yogurt_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Sweet_yogurt_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_yogurt_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Sweet_yogurt_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_yogurt_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sweet_yogurt_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Sweet_yogurt_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_yogurt_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sweet_yogurt_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Sweet_yogurt_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_yogurt_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sweet_yogurt_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Sweet_yogurt_weekly` )) # only with gender, since some regions and cities have 0
14_Sweet_milk_weeklydf %>%
group_by(`1_gender`, `14_Sweet_milk_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_milk_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Sweet_milk_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_milk_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Sweet_milk_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_milk_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Sweet_milk_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_milk_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sweet_milk_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Sweet_milk_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_milk_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sweet_milk_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Sweet_milk_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_milk_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sweet_milk_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Sweet_milk_weekly` )) # only with gender, since some regions and cities have 0
14_Sweet_creams_weeklydf %>%
group_by(`1_gender`, `14_Sweet_creams_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_creams_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Sweet_creams_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_creams_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Sweet_creams_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_creams_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Sweet_creams_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_creams_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sweet_creams_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Sweet_creams_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_creams_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sweet_creams_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Sweet_creams_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_creams_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sweet_creams_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Sweet_creams_weekly` )) # only with gender, since some regions and cities have 0
14_Karums_weeklydf %>%
group_by(`1_gender`, `14_Karums_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Karums_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Karums_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Karums_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Karums_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Karums_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Karums_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Karums_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Karums_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Karums_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Karums_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Karums_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Karums_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Karums_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Karums_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Karums_weekly` )) # only with gender, since some regions and cities have 0
14_Bread_weeklydf %>%
group_by(`1_gender`, `14_Bread_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Bread_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Bread_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Bread_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Bread_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Bread_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Bread_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Bread_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Bread_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Bread_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Bread_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Bread_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Bread_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Bread_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Bread_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Bread_weekly` )) # only with gender, since some regions and cities have 0
14_Cornflakes_not_sweetened_weeklydf %>%
group_by(`1_gender`, `14_Cornflakes_not_sweetened_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Cornflakes_not_sweetened_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Cornflakes_not_sweetened_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Cornflakes_not_sweetened_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Cornflakes_not_sweetened_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Cornflakes_not_sweetened_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Cornflakes_not_sweetened_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Cornflakes_not_sweetened_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Cornflakes_not_sweetened_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Cornflakes_not_sweetened_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Cornflakes_not_sweetened_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Cornflakes_not_sweetened_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Cornflakes_not_sweetened_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Cornflakes_not_sweetened_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Cornflakes_not_sweetened_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Cornflakes_not_sweetened_weekly` )) # only with gender, since some regions and cities have 0
14_Canned_fruits_weeklydf %>%
group_by(`1_gender`, `14_Canned_fruits_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Canned_fruits_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Canned_fruits_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Canned_fruits_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Canned_fruits_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Canned_fruits_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Canned_fruits_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Canned_fruits_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Canned_fruits_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Canned_fruits_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Canned_fruits_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Canned_fruits_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Canned_fruits_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Canned_fruits_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Canned_fruits_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Canned_fruits_weekly` )) # only with gender, since some regions and cities have 0
14_Dried_fruits_weeklydf %>%
group_by(`1_gender`, `14_Dried_fruits_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Dried_fruits_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Dried_fruits_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Dried_fruits_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Dried_fruits_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Dried_fruits_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Dried_fruits_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Dried_fruits_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Dried_fruits_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Dried_fruits_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Dried_fruits_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Dried_fruits_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Dried_fruits_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Dried_fruits_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Dried_fruits_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Dried_fruits_weekly` )) # only with gender, since some regions and cities have 0
14_Juice_or_soft_drinks_weeklydf %>%
group_by(`1_gender`, `14_Juice_or_soft_drinks_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Juice_or_soft_drinks_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Juice_or_soft_drinks_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Juice_or_soft_drinks_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Juice_or_soft_drinks_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Juice_or_soft_drinks_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Juice_or_soft_drinks_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Juice_or_soft_drinks_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Juice_or_soft_drinks_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Juice_or_soft_drinks_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Juice_or_soft_drinks_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Juice_or_soft_drinks_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Juice_or_soft_drinks_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Juice_or_soft_drinks_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Juice_or_soft_drinks_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Juice_or_soft_drinks_weekly` )) # only with gender, since some regions and cities have 0
14_Tee_cacao_or_coffee_with_sugar_weeklydf %>%
group_by(`1_gender`, `14_Tee_cacao_or_coffee_with_sugar_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Tee_cacao_or_coffee_with_sugar_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Tee_cacao_or_coffee_with_sugar_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Tee_cacao_or_coffee_with_sugar_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Tee_cacao_or_coffee_with_sugar_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Tee_cacao_or_coffee_with_sugar_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Tee_cacao_or_coffee_with_sugar_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Tee_cacao_or_coffee_with_sugar_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Tee_cacao_or_coffee_with_sugar_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Tee_cacao_or_coffee_with_sugar_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Tee_cacao_or_coffee_with_sugar_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Tee_cacao_or_coffee_with_sugar_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Tee_cacao_or_coffee_with_sugar_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Tee_cacao_or_coffee_with_sugar_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Tee_cacao_or_coffee_with_sugar_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Tee_cacao_or_coffee_with_sugar_weekly` ))
14_Marmelade_honey_syrup_or_other_sweet_souce_weeklydf %>%
group_by(`1_gender`, `14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Marmelade_honey_syrup_or_other_sweet_souce_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Marmelade_honey_syrup_or_other_sweet_souce_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Marmelade_honey_syrup_or_other_sweet_souce_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Marmelade_honey_syrup_or_other_sweet_souce_weekly` ))
14_Ice_cream_weeklydf %>%
group_by(`1_gender`, `14_Ice_cream_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Ice_cream_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Ice_cream_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Ice_cream_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Ice_cream_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Ice_cream_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Ice_cream_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Ice_cream_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Ice_cream_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Ice_cream_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Ice_cream_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Ice_cream_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Ice_cream_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Ice_cream_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Ice_cream_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Ice_cream_weekly` ))
14_Chocolate_or_chocolate_bars_weeklydf %>%
group_by(`1_gender`, `14_Chocolate_or_chocolate_bars_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chocolate_or_chocolate_bars_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Chocolate_or_chocolate_bars_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chocolate_or_chocolate_bars_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Chocolate_or_chocolate_bars_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chocolate_or_chocolate_bars_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Chocolate_or_chocolate_bars_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chocolate_or_chocolate_bars_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Chocolate_or_chocolate_bars_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Chocolate_or_chocolate_bars_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chocolate_or_chocolate_bars_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Chocolate_or_chocolate_bars_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Chocolate_or_chocolate_bars_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chocolate_or_chocolate_bars_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Chocolate_or_chocolate_bars_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Chocolate_or_chocolate_bars_weekly`))
14_Musli_bars_weeklydf %>%
group_by(`1_gender`, `14_Musli_bars_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Musli_bars_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Musli_bars_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Musli_bars_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Musli_bars_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Musli_bars_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Musli_bars_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Musli_bars_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Musli_bars_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Musli_bars_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Musli_bars_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Musli_bars_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Musli_bars_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Musli_bars_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Musli_bars_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Musli_bars_weekly`))
14_Chocolate_candies_weeklydf %>%
group_by(`1_gender`, `14_Chocolate_candies_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chocolate_candies_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Chocolate_candies_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chocolate_candies_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Chocolate_candies_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chocolate_candies_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Chocolate_candies_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chocolate_candies_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Chocolate_candies_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Chocolate_candies_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chocolate_candies_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Chocolate_candies_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Chocolate_candies_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chocolate_candies_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Chocolate_candies_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Chocolate_candies_weekly`))
14Caramel_weeklydf %>%
group_by(`1_gender`, `14Caramel_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14Caramel_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14Caramel_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14Caramel_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14Caramel_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14Caramel_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14Caramel_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14Caramel_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14Caramel_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14Caramel_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14Caramel_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14Caramel_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14Caramel_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14Caramel_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14Caramel_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14Caramel_weekly`))
14_Fresh_breath_dragees_weeklydf %>%
group_by(`1_gender`, `14_Fresh_breath_dragees_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Fresh_breath_dragees_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Fresh_breath_dragees_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Fresh_breath_dragees_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Fresh_breath_dragees_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Fresh_breath_dragees_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Fresh_breath_dragees_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Fresh_breath_dragees_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Fresh_breath_dragees_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Fresh_breath_dragees_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Fresh_breath_dragees_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Fresh_breath_dragees_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Fresh_breath_dragees_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Fresh_breath_dragees_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Fresh_breath_dragees_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Fresh_breath_dragees_weekly`))
14_Chupa-chups_or_similar_candy_weeklydf %>%
group_by(`1_gender`, `14_Chupa-chups_or_similar_candy_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chupa-chups_or_similar_candy_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Chupa-chups_or_similar_candy_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chupa-chups_or_similar_candy_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Chupa-chups_or_similar_candy_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chupa-chups_or_similar_candy_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Chupa-chups_or_similar_candy_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chupa-chups_or_similar_candy_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Chupa-chups_or_similar_candy_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Chupa-chups_or_similar_candy_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chupa-chups_or_similar_candy_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Chupa-chups_or_similar_candy_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Chupa-chups_or_similar_candy_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chupa-chups_or_similar_candy_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Chupa-chups_or_similar_candy_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Chupa-chups_or_similar_candy_weekly`))
14_Toffies_or_chewing_candies_weeklydf %>%
group_by(`1_gender`, `14_Toffies_or_chewing_candies_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Toffies_or_chewing_candies_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Toffies_or_chewing_candies_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Toffies_or_chewing_candies_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Toffies_or_chewing_candies_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Toffies_or_chewing_candies_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Toffies_or_chewing_candies_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Toffies_or_chewing_candies_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Toffies_or_chewing_candies_weekly`_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Toffies_or_chewing_candies_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Toffies_or_chewing_candies_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Toffies_or_chewing_candies_weekly`_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Toffies_or_chewing_candies_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Toffies_or_chewing_candies_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Toffies_or_chewing_candies_weekly`_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Toffies_or_chewing_candies_weekly` ))
14_Sweet_popcorn_weeklydf %>%
group_by(`1_gender`, `14_Sweet_popcorn_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_popcorn_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Sweet_popcorn_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_popcorn_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Sweet_popcorn_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_popcorn_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Sweet_popcorn_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_popcorn_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sweet_popcorn_weekly`_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Sweet_popcorn_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_popcorn_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sweet_popcorn_weekly`_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Sweet_popcorn_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sweet_popcorn_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sweet_popcorn_weekly`_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Sweet_popcorn_weekly` ))
14_Chewing_gum_with_sugar_weeklydf %>%
group_by(`1_gender`, `14_Chewing_gum_with_sugar_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chewing_gum_with_sugar_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Chewing_gum_with_sugar_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chewing_gum_with_sugar_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Chewing_gum_with_sugar_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chewing_gum_with_sugar_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Chewing_gum_with_sugar_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chewing_gum_with_sugar_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Chewing_gum_with_sugar_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Chewing_gum_with_sugar_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chewing_gum_with_sugar_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Chewing_gum_with_sugar_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Chewing_gum_with_sugar_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Chewing_gum_with_sugar_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Chewing_gum_with_sugar_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Chewing_gum_with_sugar_weekly` ))
14_Sugarfree_chewing_gum_weeklydf %>%
group_by(`1_gender`, `14_Sugarfree_chewing_gum_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sugarfree_chewing_gum_weekly` , n, fill=0)
df %>%
group_by(`2_Live_in`, `14_Sugarfree_chewing_gum_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sugarfree_chewing_gum_weekly` , n, fill=0)
df %>%
group_by(`RegionName`, `14_Sugarfree_chewing_gum_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sugarfree_chewing_gum_weekly` , n, fill=0)
df %>%
group_by(`1_gender`, `14_Sugarfree_chewing_gum_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sugarfree_chewing_gum_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sugarfree_chewing_gum_weekly_x_gender.csv")
df %>%
group_by(`2_Live_in`, `14_Sugarfree_chewing_gum_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sugarfree_chewing_gum_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sugarfree_chewing_gum_weekly_x_Live_in.csv")
df %>%
group_by(`RegionName`, `14_Sugarfree_chewing_gum_weekly` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`14_Sugarfree_chewing_gum_weekly` , n, fill=0) %>%
write.csv(,file = "./tables/14_Sugarfree_chewing_gum_weekly_x_region.csv")
chisq.test(table(df$`1_gender`, df$`14_Sugarfree_chewing_gum_weekly` ))
151_Cups_of_tee_dailydf %>%
group_by(`1_gender`, `151_Cups_of_tee_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`151_Cups_of_tee_daily` , n, fill=0)
df %>%
group_by(`2_Live_in`, `151_Cups_of_tee_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`151_Cups_of_tee_daily` , n, fill=0)
df %>%
group_by(`RegionName`, `151_Cups_of_tee_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`151_Cups_of_tee_daily` , n, fill=0)
df %>%
group_by(`1_gender`, `151_Cups_of_tee_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`151_Cups_of_tee_daily` , n, fill=0) %>%
write.csv(,file = "./tables/151_Cups_of_tee_daily_x_gender.csv")
df %>%
group_by(`2_Live_in`, `151_Cups_of_tee_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`151_Cups_of_tee_daily` , n, fill=0) %>%
write.csv(,file = "./tables/151_Cups_of_tee_daily_x_Live_in.csv")
df %>%
group_by(`RegionName`, `151_Cups_of_tee_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`151_Cups_of_tee_daily` , n, fill=0) %>%
write.csv(,file = "./tables/151_Cups_of_tee_daily_x_region.csv")
chisq.test(table(df$`1_gender`, df$`151_Cups_of_tee_daily` ))
152_Cups_of_cacao_dailydf %>%
group_by(`1_gender`, `152_Cups_of_cacao_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`152_Cups_of_cacao_daily` , n, fill=0)
df %>%
group_by(`2_Live_in`, `152_Cups_of_cacao_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`152_Cups_of_cacao_daily` , n, fill=0)
df %>%
group_by(`RegionName`, `152_Cups_of_cacao_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`152_Cups_of_cacao_daily` , n, fill=0)
df %>%
group_by(`1_gender`, `152_Cups_of_cacao_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`152_Cups_of_cacao_daily` , n, fill=0) %>%
write.csv(,file = "./tables/152_Cups_of_cacao_daily_x_gender.csv")
df %>%
group_by(`2_Live_in`, `152_Cups_of_cacao_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`152_Cups_of_cacao_daily` , n, fill=0) %>%
write.csv(,file = "./tables/152_Cups_of_cacao_daily_x_Live_in.csv")
df %>%
group_by(`RegionName`, `152_Cups_of_cacao_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`152_Cups_of_cacao_daily` , n, fill=0) %>%
write.csv(,file = "./tables/152_Cups_of_cacao_daily_x_region.csv")
chisq.test(table(df$`1_gender`, df$`152_Cups_of_cacao_daily` ))
153_Cups_of_coffee_dailydf %>%
group_by(`1_gender`, `153_Cups_of_coffee_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`153_Cups_of_coffee_daily` , n, fill=0)
df %>%
group_by(`2_Live_in`, `153_Cups_of_coffee_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`153_Cups_of_coffee_daily` , n, fill=0)
df %>%
group_by(`RegionName`, `153_Cups_of_coffee_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`153_Cups_of_coffee_daily` , n, fill=0)
df %>%
group_by(`1_gender`, `153_Cups_of_coffee_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`153_Cups_of_coffee_daily` , n, fill=0) %>%
write.csv(,file = "./tables/153_Cups_of_coffee_daily_x_gender.csv")
df %>%
group_by(`2_Live_in`, `153_Cups_of_coffee_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`153_Cups_of_coffee_daily` , n, fill=0) %>%
write.csv(,file = "./tables/153_Cups_of_coffee_daily_x_Live_in.csv")
df %>%
group_by(`RegionName`, `153_Cups_of_coffee_daily` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`153_Cups_of_coffee_daily` , n, fill=0) %>%
write.csv(,file = "./tables/153_Cups_of_coffee_daily_x_region.csv")
chisq.test(table(df$`1_gender`, df$`153_Cups_of_coffee_daily` ))
161_Tsp_sugar_for_one_teedf %>%
group_by(`1_gender`, `161_Tsp_sugar_for_one_tee` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`161_Tsp_sugar_for_one_tee` , n, fill=0)
df %>%
group_by(`2_Live_in`, `161_Tsp_sugar_for_one_tee` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`161_Tsp_sugar_for_one_tee` , n, fill=0)
df %>%
group_by(`RegionName`, `161_Tsp_sugar_for_one_tee` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`161_Tsp_sugar_for_one_tee` , n, fill=0)
df %>%
group_by(`1_gender`, `161_Tsp_sugar_for_one_tee` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`161_Tsp_sugar_for_one_tee` , n, fill=0) %>%
write.csv(,file = "./tables/161_Tsp_sugar_for_one_tee_x_gender.csv")
df %>%
group_by(`2_Live_in`, `161_Tsp_sugar_for_one_tee` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`161_Tsp_sugar_for_one_tee` , n, fill=0) %>%
write.csv(,file = "./tables/161_Tsp_sugar_for_one_tee_x_Live_in.csv")
df %>%
group_by(`RegionName`, `161_Tsp_sugar_for_one_tee` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`161_Tsp_sugar_for_one_tee` , n, fill=0) %>%
write.csv(,file = "./tables/161_Tsp_sugar_for_one_tee_x_region.csv")
chisq.test(table(df$`1_gender`, df$`161_Tsp_sugar_for_one_tee` ))
162_Tsp_sugar_for_one_cacaodf %>%
group_by(`1_gender`, `162_Tsp_sugar_for_one_cacao` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`162_Tsp_sugar_for_one_cacao` , n, fill=0)
df %>%
group_by(`2_Live_in`, `162_Tsp_sugar_for_one_cacao` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`162_Tsp_sugar_for_one_cacao` , n, fill=0)
df %>%
group_by(`RegionName`, `162_Tsp_sugar_for_one_cacao` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`162_Tsp_sugar_for_one_cacao` , n, fill=0)
df %>%
group_by(`1_gender`, `162_Tsp_sugar_for_one_cacao` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`162_Tsp_sugar_for_one_cacao` , n, fill=0) %>%
write.csv(,file = "./tables/162_Tsp_sugar_for_one_cacao_x_gender.csv")
df %>%
group_by(`2_Live_in`, `162_Tsp_sugar_for_one_cacao` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`162_Tsp_sugar_for_one_cacao` , n, fill=0) %>%
write.csv(,file = "./tables/162_Tsp_sugar_for_one_cacao_x_Live_in.csv")
df %>%
group_by(`RegionName`, `162_Tsp_sugar_for_one_cacao` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`162_Tsp_sugar_for_one_cacao` , n, fill=0) %>%
write.csv(,file = "./tables/162_Tsp_sugar_for_one_cacao_x_region.csv")
chisq.test(table(df$`1_gender`, df$`162_Tsp_sugar_for_one_cacao` ))
163_Tsp_sugar_for_one_coffeedf %>%
group_by(`1_gender`, `163_Tsp_sugar_for_one_coffee` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`163_Tsp_sugar_for_one_coffee` , n, fill=0)
df %>%
group_by(`2_Live_in`, `163_Tsp_sugar_for_one_coffee` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`163_Tsp_sugar_for_one_coffee` , n, fill=0)
df %>%
group_by(`RegionName`, `163_Tsp_sugar_for_one_coffee` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`163_Tsp_sugar_for_one_coffee` , n, fill=0)
df %>%
group_by(`1_gender`, `163_Tsp_sugar_for_one_coffee` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`163_Tsp_sugar_for_one_coffee` , n, fill=0) %>%
write.csv(,file = "./tables/163_Tsp_sugar_for_one_coffee_x_gender.csv")
df %>%
group_by(`2_Live_in`, `163_Tsp_sugar_for_one_coffee` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`163_Tsp_sugar_for_one_coffee` , n, fill=0) %>%
write.csv(,file = "./tables/163_Tsp_sugar_for_one_coffee_x_Live_in.csv")
df %>%
group_by(`RegionName`, `163_Tsp_sugar_for_one_coffee` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`163_Tsp_sugar_for_one_coffee` , n, fill=0) %>%
write.csv(,file = "./tables/163_Tsp_sugar_for_one_coffee_x_region.csv")
chisq.test(table(df$`1_gender`, df$`163_Tsp_sugar_for_one_coffee` ))
17_Selfevaluated_dietary_habitsdf %>%
group_by(`1_gender`, `17_Selfevaluated_dietary_habits` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`17_Selfevaluated_dietary_habits` , n, fill=0)
df %>%
group_by(`2_Live_in`, `17_Selfevaluated_dietary_habits` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`17_Selfevaluated_dietary_habits` , n, fill=0)
df %>%
group_by(`RegionName`, `17_Selfevaluated_dietary_habits` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`17_Selfevaluated_dietary_habits` , n, fill=0)
df %>%
group_by(`1_gender`, `17_Selfevaluated_dietary_habits` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`17_Selfevaluated_dietary_habits` , n, fill=0) %>%
write.csv(,file = "./tables/17_Selfevaluated_dietary_habits_x_gender.csv")
df %>%
group_by(`2_Live_in`, `17_Selfevaluated_dietary_habits` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`17_Selfevaluated_dietary_habits` , n, fill=0) %>%
write.csv(,file = "./tables/17_Selfevaluated_dietary_habits_x_Live_in.csv")
df %>%
group_by(`RegionName`, `17_Selfevaluated_dietary_habits` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`17_Selfevaluated_dietary_habits` , n, fill=0) %>%
write.csv(,file = "./tables/17_Selfevaluated_dietary_habits_x_region.csv")
chisq.test(table(df$`1_gender`, df$`17_Selfevaluated_dietary_habits` ))
18_Frequency_of_smokingdf %>%
group_by(`1_gender`, `18_Frequency_of_smoking` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`18_Frequency_of_smoking` , n, fill=0)
df %>%
group_by(`2_Live_in`, `18_Frequency_of_smoking` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`18_Frequency_of_smoking` , n, fill=0)
df %>%
group_by(`RegionName`, `18_Frequency_of_smoking` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`18_Frequency_of_smoking` , n, fill=0)
df %>%
group_by(`1_gender`, `18_Frequency_of_smoking` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`18_Frequency_of_smoking` , n, fill=0) %>%
write.csv(,file = "./tables/18_Frequency_of_smoking_x_gender.csv")
df %>%
group_by(`2_Live_in`, `18_Frequency_of_smoking` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`18_Frequency_of_smoking` , n, fill=0) %>%
write.csv(,file = "./tables/18_Frequency_of_smoking_x_Live_in.csv")
df %>%
group_by(`RegionName`, `18_Frequency_of_smoking` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`18_Frequency_of_smoking` , n, fill=0) %>%
write.csv(,file = "./tables/18_Frequency_of_smoking_x_region.csv")
chisq.test(table(df$`1_gender`, df$`18_Frequency_of_smoking` ))
19_Tobacco_usage_(not_smoking)_in_last_30_daysdf %>%
group_by(`1_gender`, `19_Tobacco_usage_(not_smoking)_in_last_30_days` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`19_Tobacco_usage_(not_smoking)_in_last_30_days` , n, fill=0)
df %>%
group_by(`2_Live_in`, `19_Tobacco_usage_(not_smoking)_in_last_30_days` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`19_Tobacco_usage_(not_smoking)_in_last_30_days` , n, fill=0)
df %>%
group_by(`RegionName`, `19_Tobacco_usage_(not_smoking)_in_last_30_days` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`19_Tobacco_usage_(not_smoking)_in_last_30_days` , n, fill=0)
df %>%
group_by(`1_gender`, `19_Tobacco_usage_(not_smoking)_in_last_30_days` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`19_Tobacco_usage_(not_smoking)_in_last_30_days` , n, fill=0) %>%
write.csv(,file = "./tables/19_Tobacco_usage_(not_smoking)_in_last_30_days_x_gender.csv")
df %>%
group_by(`2_Live_in`, `19_Tobacco_usage_(not_smoking)_in_last_30_days` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`19_Tobacco_usage_(not_smoking)_in_last_30_days` , n, fill=0) %>%
write.csv(,file = "./tables/19_Tobacco_usage_(not_smoking)_in_last_30_days_x_Live_in.csv")
df %>%
group_by(`RegionName`, `19_Tobacco_usage_(not_smoking)_in_last_30_days` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`19_Tobacco_usage_(not_smoking)_in_last_30_days` , n, fill=0) %>%
write.csv(,file = "./tables/19_Tobacco_usage_(not_smoking)_in_last_30_days_x_region.csv")
chisq.test(table(df$`1_gender`, df$`19_Tobacco_usage_(not_smoking)_in_last_30_days` ))
20_Own_toothbrushdf %>%
group_by(`1_gender`, `20_Own_toothbrush` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`20_Own_toothbrush` , n, fill=0)
df %>%
group_by(`2_Live_in`, `20_Own_toothbrush` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`20_Own_toothbrush` , n, fill=0)
df %>%
group_by(`RegionName`, `20_Own_toothbrush` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`20_Own_toothbrush` , n, fill=0)
df %>%
group_by(`1_gender`, `20_Own_toothbrush` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`20_Own_toothbrush` , n, fill=0) %>%
write.csv(,file = "./tables/20_Own_toothbrush_x_gender.csv")
df %>%
group_by(`2_Live_in`, `20_Own_toothbrush` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`20_Own_toothbrush` , n, fill=0) %>%
write.csv(,file = "./tables/20_Own_toothbrush_x_Live_in.csv")
df %>%
group_by(`RegionName`, `20_Own_toothbrush` ) %>%
summarise( n = n()) %>%
ungroup() %>%
spread(`20_Own_toothbrush` , n, fill=0) %>%
write.csv(,file = "./tables/20_Own_toothbrush_x_region.csv")
chisq.test(table(df$`1_gender`, df$`20_Own_toothbrush` ))
ggplot(df, aes(`3_Pain_or_other_dental_disorders_in_last_12_months`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/3_Pain_or_other_dental_disorders_in_last_12_months.png")
ggplot(df, aes(`4_Frequency_of_dentist_visits_in_last_12_months`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/4_Frequency_of_dentist_visits_in_last_12_months.png")
ggplot(df, aes(`5_Reason_to_attend_dentist`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/5_Reason_to_attend_dentist.png")
ggplot(df, aes(`6Public_or_privat_dentist`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/6Public_or_privat_dentist.png")
ggplot(df, aes(`7_Frequency_of_dental_hygienist_visits`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/7_Frequency_of_dental_hygienist_visits.png")
ggplot(df, aes(`8_Frequency_of_toothbrushing`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/8_Frequency_of_toothbrushing.png")
ggplot(df, aes(`9_Usage_of_toothpaste`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/9_Usage_of_toothpaste.png")
ggplot(df, aes(`9_Usage_of_toothbrush`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/9_Usage_of_toothbrush.png")
ggplot(df, aes(`9_Usage_of_dental_floss`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/9_Usage_of_dental_floss.png")
ggplot(df, aes(`9_Usage_of_tooth_picks`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/9_Usage_of_tooth_picks.png")
ggplot(df, aes(`9_Usage_of_mouth_wash`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/9_Usage_of_mouth_wash.png")
ggplot(df, aes(`9Usage_of_tounge_cleaner`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/9Usage_of_tounge_cleaner.png")
ggplot(df, aes(`9_Usage_of_other_hygiene_appliance`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/9_Usage_of_other_hygiene_appliance.png")
ggplot(df, aes(`10_Fluoride_in_toothpaste`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/10_Fluoride_in_toothpaste.png")
ggplot(df, aes(`11_Usage_of_fluoride_supplements`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/11_Usage_of_fluoride_supplements.png")
ggplot(df, aes(`12_Selfevaluated_oral_hygiene_care`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/12_Selfevaluated_oral_hygiene_care.png")
ggplot(df, aes(`13_Eating_habits_grouped`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/13_Eating_habits_grouped.png")
ggplot(df, aes(`14_Sweet_yogurt_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Sweet_yogurt_weekly.png")
ggplot(df, aes(`14_Sweet_milk_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Sweet_milk_weekly.png")
ggplot(df, aes(`14_Sweet_creams_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Sweet_creams_weekly.png")
ggplot(df, aes(`14_Karums_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Karums_weekly.png")
ggplot(df, aes(`14_Bread_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Bread_weekly.png")
ggplot(df, aes(`14_Cornflakes_not_sweetened_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Cornflakes_not_sweetened_weekly.png")
ggplot(df, aes(`14_Sweet_cornflakes_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Sweet_cornflakes_weekly.png")
ggplot(df, aes(`14_Canned_fruits_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Canned_fruits_weekly.png")
ggplot(df, aes(`14_Dried_fruits_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Dried_fruits_weekly.png")
ggplot(df, aes(`14_Juice_or_soft_drinks_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Juice_or_soft_drinks_weekly.png")
ggplot(df, aes(`14_Tee_cacao_or_coffee_with_sugar_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Tee_cacao_or_coffee_with_sugar_weekly.png")
ggplot(df, aes(`14_Marmelade_honey_syrup_or_other_sweet_souce_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Marmelade_honey_syrup_or_other_sweet_souce_weekly.png")
ggplot(df, aes(`14_Ice_cream_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Ice_cream_weekly.png")
ggplot(df, aes(`14_Cookies_or_wafles_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Cookies_or_wafles_weekly.png")
ggplot(df, aes(`14_Cakes_or_sweet_breads_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Cakes_or_sweet_breads_weekly.png")
ggplot(df, aes(`14_Chocolate_or_chocolate_bars_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Chocolate_or_chocolate_bars_weekly.png")
ggplot(df, aes(`14_Musli_bars_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Musli_bars_weekly.png")
ggplot(df, aes(`14_Chocolate_candies_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Chocolate_candies_weekly.png")
ggplot(df, aes(`14Caramel_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14Caramel_weekly.png")
ggplot(df, aes(`14_Fresh_breath_dragees_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Fresh_breath_dragees_weekly.png")
ggplot(df, aes(`14_Chupa-chups_or_similar_candy_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Chupa-chups_or_similar_candy_weekly.png")
ggplot(df, aes(`14_Toffies_or_chewing_candies_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Toffies_or_chewing_candies_weekly.png")
ggplot(df, aes(`14_Potato_chips_or_salty_cookies_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Potato_chips_or_salty_cookies_weekly.png")
ggplot(df, aes(`14_Sweet_popcorn_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Sweet_popcorn_weekly.png")
ggplot(df, aes(`14_Chewing_gum_with_sugar_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Chewing_gum_with_sugar_weekly.png")
ggplot(df, aes(`14_Sugarfree_chewing_gum_weekly`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/14_Sugarfree_chewing_gum_weekly.png")
ggplot(df, aes(`151_Cups_of_tee_daily`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/151_Cups_of_tee_daily.png")
ggplot(df, aes(`152_Cups_of_cacao_daily`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/152_Cups_of_cacao_daily.png")
ggplot(df, aes(`153_Cups_of_coffee_daily`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/153_Cups_of_coffee_daily.png")
ggplot(df, aes(`161_Tsp_sugar_for_one_tee`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/161_Tsp_sugar_for_one_tee.png")
ggplot(df, aes(`162_Tsp_sugar_for_one_cacao`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/162_Tsp_sugar_for_one_cacao.png")
ggplot(df, aes(`163_Tsp_sugar_for_one_coffee`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/163_Tsp_sugar_for_one_coffee.png")
ggplot(df, aes(`17_Selfevaluated_dietary_habits`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/17_Selfevaluated_dietary_habits.png")
ggplot(df, aes(`18_Frequency_of_smoking`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/18_Frequency_of_smoking.png")
ggplot(df, aes(`19_Tobacco_usage_(not_smoking)_in_last_30_days`)) + geom_bar() + theme_minimal() + ggsave(file = "./plots/19_Tobacco_usage_(not_smoking)_in_last_30_days.png")
erosion <- df %>%
gather("Tooth_erosion", "erosion_status", `Erosion_[17]`:`Erosion_[37]`) %>%
separate(Tooth_erosion, c("Tooth_erosion", "Surface_erosion"), sep = -2) %>%
separate(Tooth_erosion, c("Type", "Tooth"), sep = -3)
levels(erosion$erosion_status)[(erosion$erosion_status) == "NA"] <- "0"
erosion$Tooth <- as.factor(erosion$Tooth) # convert to factor
erosion$Tooth <- ordered(erosion$Tooth, levels = c("17", "16", "15", "14", "13", "12", "11",
"21", "22", "23", "24", "25", "26", "27",
"47", "46", "45", "44", "43", "42", "41",
"31", "32", "33", "34", "35", "36", "37"))
erosion_by_tooth <- ftable(erosion$Tooth, erosion$erosion_status)
capture.output(erosion_by_tooth, file = "./tables/erosion_by_tooth.txt")
rm(erosion_by_tooth)
erosion %>%
group_by(Tooth, erosion_status) %>%
summarise(n = n()) %>%
spread(erosion_status, n, fill = 0) %>%
write.csv(,file = "./tables/tooth_x_erosionstatus.csv")
erosion %>%
group_by(ID, Tooth, erosion_status) %>%
summarise(n = n()) %>%
spread(Tooth, erosion_status, fill = 0) %>%
write.csv(,file = "./tables/ID_x_erosionstatus.csv")
# r erosion por niño
erosion_max_df <- erosion %>%
group_by(ID, Tooth) %>%
summarise(erosionmax = max(erosion_status)) %>%
spread(Tooth, erosionmax, fill = 0) %>%
write.csv(,file = "./tables/ID_x_tooth_erosion_status.csv")
rm(erosion)
% de ninos, que tienen trauma (1-6) = 259, 12.11% % de ninos, que tienen 1 = 51, 2.4% % de ninos, que tienen 2 = 193, 9.0% % de ninos, que tienen 3 = 13, 0.31% % de ninos, que tienen 4 = 4, 0.09% % de ninos, que tienen 5 = 1, 0.05% % de ninos, que tienen 6 = 0 Cuantos dientes promedio con trauma (de ninos con traums, min, max, otros valores) 0.29 dientes DE 1.27
trauma <- df %>%
gather("Tooth_trauma", "Trauma_status", `Trauma_[17]`:`Trauma_[37]`) %>%
separate(Tooth_trauma, c("Tooth_trauma", "Surface_trauma"), sep = -2) %>%
separate(Tooth_trauma, c("Type", "Tooth"), sep = -3) %>%
select(-c(Type, Surface_trauma)) %>%
select(-c(C17V:`Erosion_[37]`)) %>%
select(-c(`9_CPI_[16/17]`: `12b)_3__lokalization_of_pathology`)) %>%
select(-c(`3_Pain_or_other_dental_disorders_in_last_12_months`: `27_Frequency_of_travels_in_abroad_in_last_12_months_with_family`))
levels(trauma$Trauma_status)[(trauma$Trauma_status) == "NA"] <- "0"
trauma$Tooth <- as.factor(trauma$Tooth) # convert to factor
trauma$Tooth <- ordered(trauma$Tooth, levels = c("17", "16", "15", "14", "13", "12", "11",
"21", "22", "23", "24", "25", "26", "27",
"47", "46", "45", "44", "43", "42", "41",
"31", "32", "33", "34", "35", "36", "37"))
trauma_by_tooth <- ftable(trauma$Tooth, trauma$Trauma_status)
trauma_by_tooth
capture.output(trauma_by_tooth, file = "./tables/trauma_by_tooth.txt")
rm(trauma_by_tooth)
# r trauma por niño}
trauma <- trauma %>%
group_by(ID, Tooth) %>%
summarise(traumamax = max(Trauma_status)) %>%
spread(Tooth, traumamax, fill = 0) %>%
write.csv(,file = "./tables/ID_x_tooth_trauma_status.csv")
rm(trauma)
1. % de ninos que todos CPITN tiene 0 : 547, 25.58%
2. % de ninos que maximum valor de CPITN, tiene 1 (sangramiento): 1110, 51.92%
3. % de ninos, que tienen 2: 477, 22.31%
4. % de ninos, que tienen 3: 3, 0.14%
5. % de ninos, que tienen 4: 1, 0.05%
periodontal <- df %>%
gather("Tooth", "perio_status", `9_CPI_[16/17]`:`9_CPI_[36/37]`) %>%
separate(Tooth, c("Tooth", "Surface"), sep = -8) %>%
select(-c(`C17V`: `Trauma_[37]`))
periodontal$Surface <- as.factor(periodontal$Surface) # convert to factor
periodontal$Surface <- ordered(periodontal$Surface, levels = c("[16/17]",
"PI_[11]",
"[26/27]",
"[46/47]",
"PI_[31]",
"[36/37]"))
periodontal %>%
group_by(Surface, perio_status) %>%
summarise(n = n()) %>%
spread(perio_status, n, fill = 0) %>%
write.csv(,file = "./tables/tooth_x_periostatus.csv")
periodontal %>%
group_by(ID, Surface, perio_status) %>%
summarise(n = n()) %>%
spread(Surface, perio_status, fill = 0) %>%
write.csv(,file = "./tables/ID_x_periotatus.csv")
# GENDER
periodontal %>%
group_by(`1_gender`, perio_status) %>%
summarise(n = n()) %>%
spread(perio_status, n, fill = 0) %>%
write.csv(,file = "./tables/tooth_x_gender_periostatus.csv")
# REGION
periodontal %>%
group_by(RegionName, perio_status) %>%
summarise(n = n()) %>%
spread(perio_status, n, fill = 0) %>%
write.csv(,file = "./tables/tooth_x_region_periostatus.csv")
# CITY
periodontal %>%
group_by(`2_Live_in`, perio_status) %>%
summarise(n = n()) %>%
spread(perio_status, n, fill = 0) %>%
write.csv(,file = "./tables/tooth_x_livein_periostatus.csv")
rm(periodontal)
1. % de ninos, que tienen fluorosis (1-5): 23, 1.08%
1. % de ninos, que tienen 1: 11, 0.51%
2. % de ninos, que tienen 2: 8, 0.37%
3. % de ninos, que tienen 3: 4, 0.19%
df %>%
group_by(`10_Fluorosis`) %>%
summarise(n=n()) %>%
write.csv(file = "./tables/fluorosis.csv", row.names = F)
df %>%
group_by(`1_gender`, `10_Fluorosis`) %>%
summarise(n=n()) %>%
spread(`10_Fluorosis`, n, fill = 0) %>%
write.csv(file = "./tables/fluorosis_x_gender.csv", row.names = F)
df %>%
group_by(RegionName, `10_Fluorosis`) %>%
summarise(n=n()) %>%
spread(`10_Fluorosis`, n, fill = 0) %>%
write.csv(file = "./tables/fluorosis_x_region.csv", row.names = F)
df %>%
group_by(`2_Live_in`, `10_Fluorosis`) %>%
summarise(n=n()) %>%
spread(`10_Fluorosis`, n , fill = 0) %>%
write.csv(file = "./tables/fluorosis_x_livein.csv", row.names = F)
1. % de ninos que tienen tratamiento (1): 60, 2.8%
df %>%
group_by(`11_Orthodontic_treatment`) %>%
summarise(n=n())
1. % de ninos, que tienen alguna patologia (1-6):27, 1.26%
1. % de ninos, que tienen 1
2. % de ninos, que tienen 2
3. % de ninos, que tienen 3
4. % de ninos, que tienen 4
5. % de ninos, que tienen 5
2. en que lugar tienen patologias
1. % de patologias en lugar 1
1. % de patologia 1 en lugar 1
2. % de patologia 2 en lugar 1
3. % de patologia 3 en lugar 1
4. % de patologia 4 en lugar 1
5. % de patologia 5 en lugar 1
2. % de patologias en lugar 2
1. % de patologia 1 en lugar 2
2. % de patologia 2 en lugar 2
3. % de patologia 3 en lugar 2
4. % de patologia 4 en lugar 2
5. % de patologia 5 en lugar 2
3. % de patologias en lugar 3
1. % de patologia 1 en lugar 3
2. % de patologia 2 en lugar 3
3. % de patologia 3 en lugar 3
4. % de patologia 4 en lugar 3
5. % de patologia 5 en lugar 3
4. % de patologias en lugar 4
1. % de patologia 1 en lugar 4
2. % de patologia 2 en lugar 4
3. % de patologia 3 en lugar 4
4. % de patologia 4 en lugar 4
5. % de patologia 5 en lugar 4
5. % de patologias en lugar 5
1. % de patologia 1 en lugar 5
2. % de patologia 2 en lugar 5
3. % de patologia 3 en lugar 5
4. % de patologia 4 en lugar 5
5. % de patologia 5 en lugar 5
6. % de patologias en lugar 6
1. % de patologia 1 en lugar 6
2. % de patologia 2 en lugar 6
3. % de patologia 3 en lugar 6
4. % de patologia 4 en lugar 6
5. % de patologia 5 en lugar 6
7. % de patologias en lugar 7
1. % de patologia 1 en lugar 7
2. % de patologia 2 en lugar 7
3. % de patologia 3 en lugar 7
4. % de patologia 4 en lugar 7
5. % de patologia 5 en lugar 7
8. % de patologias en lugar 8
1. % de patologia 1 en lugar 8
2. % de patologia 2 en lugar 8
3. % de patologia 3 en lugar 8
4. % de patologia 4 en lugar 8
5. % de patologia 5 en lugar 8
table(df$`12a)_1_oral_pathology`)
table(df$`12a)_2_oral_pathology`)
table(df$`12a)_3_oral_pathology`)
x <- table(df$`12a)_1_oral_pathology`, df$`12b)_1_lokalization_of_pathology`)
capture.output(x, file = "./tables/pato1.csv")
x <- table(df$`12a)_2_oral_pathology`, df$`12b)_2__lokalization_of_pathology`)
capture.output(x, file = "./tables/pato2.csv")
x <- table(df$`12a)_3_oral_pathology`, df$`12b)_3__lokalization_of_pathology`)
capture.output(x, file = "./tables/pato3.csv")
rm(x)
Recode variables, ver en https://docs.google.com/spreadsheets/d/12B-2CZM35lt2-DhIHd6t5QylL2oDYil1TsAde_NWNKQ/edit#gid=720350908
caries <- df
caries <- caries %>%
select(-c(`Erosion_[17]`:`12b)_3__lokalization_of_pathology`)) %>%
select(-c(`3_Pain_or_other_dental_disorders_in_last_12_months`:`27_Frequency_of_travels_in_abroad_in_last_12_months_with_family`)) %>%
select(-c(Amount, Age, Time, `1_Examinator` )) %>%
select(-c(`2_Examination_date`, RegionsKods, SkolasKods, `3c_Child_nr`,
`3d_Examination_time_(forst_or_second)`, `4_Birth_date`,
FAS))
# para caries
caries[,1:140] <- ifelse(caries[,1:140] == "0", "0",
ifelse(caries[,1:140] == "98", "0",
ifelse(caries[,1:140] == "99", "0",
ifelse(caries[,1:140] == "A", "1",
ifelse(caries[,1:140] == "B", "2",
ifelse(caries[,1:140] == "C", "3",
ifelse(caries[,1:140] == "97", "4",
"na")))))))
caries[,1:140] <- lapply(caries[,1:140], as.factor) # all the caries status to factors # all the caries status to factors
#para restauraciones
caries[,141:280] <- ifelse(caries[,141:280] == "0", "0",
ifelse(caries[,141:280] == "1", "10",
ifelse(caries[,141:280] == "2", "20",
ifelse(caries[,141:280] == "3", "30",
ifelse(caries[,141:280] == "4", "40",
"na")))))
caries[,141:280] <- lapply(caries[,141:280], as.factor)
# create two new datasets, one for C and another for R
caries_c <- caries %>%
select(-c(R17V:R37V)) %>%
gather("Tooth_c", "C", C17V:C37V) %>%
mutate(ID_Tooth = paste(ID, Tooth_c, sep = "_") )
caries_r <- caries %>%
select(-c(C17V:C37V)) %>%
gather("Tooth_r", "R", R17V:R37V) %>%
select(-c(`1_gender`, `2_Live_in`, FAS_cat, RegionName, SkolaName)) %>%
mutate(ID_Tooth = paste(ID, Tooth_r, sep = "_") )
caries_r$ID_Tooth <- gsub("_R", "_C", caries_r$ID_Tooth)
caries <- left_join(caries_c, caries_r, by = "ID_Tooth")
rm(caries_c); rm(caries_r)
caries[caries=="na"] <- 0 #recodifico el único na de c
caries$C <- as.integer(caries$C)
caries$R <- as.integer(caries$R)
caries <- caries %>%
mutate(Suma_C_mas_R = rowSums( cbind (R,C), na.rm=TRUE))
# recode
caries$DMFS [caries$Suma_C_mas_R == 0 ] <- 0
caries$DMFS [caries$Suma_C_mas_R == 1 ] <- 1
caries$DMFS [caries$Suma_C_mas_R == 11 ] <- 1
caries$DMFS [caries$Suma_C_mas_R == 21 ] <- 2
caries$DMFS [caries$Suma_C_mas_R == 31 ] <- 2
caries$DMFS [caries$Suma_C_mas_R == 41 ] <- 2
caries$DMFS [caries$Suma_C_mas_R == 2 ] <- 3
caries$DMFS [caries$Suma_C_mas_R == 3 ] <- 3
caries$DMFS [caries$Suma_C_mas_R == 12 ] <- 3
caries$DMFS [caries$Suma_C_mas_R == 13 ] <- 3
caries$DMFS [caries$Suma_C_mas_R == 22 ] <- 3
caries$DMFS [caries$Suma_C_mas_R == 23 ] <- 3
caries$DMFS [caries$Suma_C_mas_R == 32 ] <- 3
caries$DMFS [caries$Suma_C_mas_R == 33 ] <- 3
caries$DMFS [caries$Suma_C_mas_R == 42 ] <- 3
caries$DMFS [caries$Suma_C_mas_R == 43 ] <- 3
caries$DMFS [caries$Suma_C_mas_R == 4 ] <- 4
Now separate Tooth caries in the last letter
caries <- caries %>%
separate(Tooth_c, c("Tooth", "Surface"), sep = -2) %>%
separate(Tooth, c("Omit", "Tooth"), sep = -3) %>%
select(-c(ID_Tooth, ID.y, Tooth_r, Omit))
caries$Tooth <- as.factor(caries$Tooth) # convert to factor
caries$Tooth <- ordered(caries$Tooth, levels = c("17", "16", "15", "14", "13", "12", "11",
"21", "22", "23", "24", "25", "26", "27",
"47", "46", "45", "44", "43", "42", "41",
"31", "32", "33", "34", "35", "36", "37"))
caries %>%
group_by(DMFS, Tooth) %>%
summarise(n = n()) %>%
spread(Tooth, n, fill = 0) %>%
write.csv(file = "./tables/DMFSxtooth.csv")
DMFT <- caries %>%
unite(Tooth_surface, Tooth, Surface) %>%
spread(Tooth_surface, Suma_C_mas_R)
DMFT resumido
DMFT_resumido <- read_csv2("DMFT_para_calculos.csv")
DMFT_resumido %>%
group_by(`1_gender`, `d1d3mft-bin`) %>%
summarise(n = n()) %>%
spread(`d1d3mft-bin`, n)
chisq.test(table(DMFT_resumido$`1_gender`, DMFT_resumido$`d1d3mft-bin`))
DMFT_resumido %>%
group_by(`1_gender`, d3mftbin) %>%
summarise(n=n()) %>%
spread(d3mftbin, n)
chisq.test(table(DMFT_resumido$`1_gender`, DMFT_resumido$d3mftbin))
DMFT_resumido %>%
group_by(RegionName, `d1d3mft-bin`) %>%
summarise( n= n()) %>%
spread(`d1d3mft-bin`, n)
chisq.test(table(DMFT_resumido$RegionName, DMFT_resumido$`d1d3mft-bin`))
DMFT_resumido %>%
group_by(RegionName, d3mftbin) %>%
summarise(n=n()) %>%
spread(d3mftbin, n)
chisq.test(table(DMFT_resumido$RegionName, DMFT_resumido$d3mftbin))
DMFT_resumido %>%
group_by(FAS_cat, `d1d3mft-bin`) %>%
summarise(n = n()) %>%
spread(`d1d3mft-bin`, n)
chisq.test(table(DMFT_resumido$FAS_cat, DMFT_resumido$`d1d3mft-bin`))
DMFT_resumido %>%
group_by(FAS_cat, `d3mftbin`) %>%
summarise(n = n()) %>%
spread(`d3mftbin`, n)
chisq.test(table(DMFT_resumido$FAS_cat, DMFT_resumido$d3mftbin))
df.log <- read_csv("Prevalence_for_analysis.csv")
df.log$`8_Frequency_of_toothbrushing`[df.log$`8_Frequency_of_toothbrushing`=="Once per day"] <- "0"
df.log$`8_Frequency_of_toothbrushing`[df.log$`8_Frequency_of_toothbrushing`=="Two or more times per day"] <- "0"
df.log$`1_gender` <- ifelse(df.log$`1_gender` == "F", 0 ,1)
df.log$FAS_cat <- ifelse(df.log$FAS_cat == "High affluence", 1 ,0)
df.log$`8_Frequency_of_toothbrushing` <- ifelse(df.log$`8_Frequency_of_toothbrushing` == "0", 1 ,0)
df.log$`4_Frequency_of_dentist_visits_in_last_12_months` <- ifelse(df.log$`4_Frequency_of_dentist_visits_in_last_12_months` == "Two or more times", 0 ,1)
df.log$`7_Frequency_of_dental_hygienist_visits` <- ifelse(df.log$`7_Frequency_of_dental_hygienist_visits` == "Two or more times per year", 0 ,1)
df.log$`9_Usage_of_dental_floss` <- ifelse(df.log$`9_Usage_of_dental_floss` == "Yes", 0 ,1)
df.log$`9_Usage_of_mouth_wash` <- ifelse(df.log$`9_Usage_of_mouth_wash` == "Yes", 0 ,1)
df.log$`11_Usage_of_fluoride_supplements` <- ifelse(df.log$`11_Usage_of_fluoride_supplements` == "Yes, now", 0 ,1)
df.log$`13_Eating_habits_grouped` <- ifelse(df.log$`13_Eating_habits_grouped` == 1, 1 ,0)
df.log$`18_Frequency_of_smoking` <- ifelse(df.log$`18_Frequency_of_smoking` == "Never", 1 ,0)
df.log$SUMA_TSP_Sugar <- ifelse(df.log$SUMA_TSP_Sugar < 3, 0 ,1)
df.log$`d1d3mft-bin` <- ifelse(df.log$`d1d3mft-bin` == 0, 0 ,1)
df.log$d3mftbin <- ifelse(df.log$d3mftbin == 0, 0 ,1)
d1 <- glm(`d1d3mft-bin` ~
`1_gender` +
FAS_cat +
`8_Frequency_of_toothbrushing` +
`4_Frequency_of_dentist_visits_in_last_12_months` +
`7_Frequency_of_dental_hygienist_visits` +
`9_Usage_of_dental_floss` +
`9_Usage_of_mouth_wash` +
`11_Usage_of_fluoride_supplements` +
`13_Eating_habits_grouped` +
SUMA_TSP_Sugar,
data = df.log,
family = binomial)
summary(D1.model_1)
exp(cbind(OR = coef(D1.model_1), confint(D1.model_1)))
d2 <- glm(`d1d3mft-bin` ~
`1_gender` +
`8_Frequency_of_toothbrushing` +
`4_Frequency_of_dentist_visits_in_last_12_months` +
`7_Frequency_of_dental_hygienist_visits` +
`11_Usage_of_fluoride_supplements` +
`13_Eating_habits_grouped` +
SUMA_TSP_Sugar,
data = df.log,
family = binomial)
summary(D1.model_2)
stargazer(d1, d2, type="text", digits=3,
dep.var.labels=c("Caries at D1 (= 1)"),
covariate.labels=c("Sex (male = 1)",
"FAS (Low = 1)",
"Freq Toothbrushing ( < once per week = 1)",
"Freq visit dentist ( < once per year = 1)",
"Freq visit hygienist ( < once per year = 1)",
"Dental floss (no use = 1)",
"Mouthwash (no use = 1)",
"Use of fluoride supplement (no use = 1)",
"Eating habits (high in sweet = 1)",
"More than one teaspoon in tea, coffee or cacao"),
out="modelsD1.txt")
d3 <- glm(d3mftbin ~
`1_gender` +
FAS_cat +
`8_Frequency_of_toothbrushing` +
`4_Frequency_of_dentist_visits_in_last_12_months` +
`7_Frequency_of_dental_hygienist_visits` +
`9_Usage_of_dental_floss` +
`9_Usage_of_mouth_wash` +
`11_Usage_of_fluoride_supplements` +
`13_Eating_habits_grouped` +
SUMA_TSP_Sugar,
data = df.log,
family = binomial)
d4 <- glm(d3mftbin ~
`1_gender` +
`8_Frequency_of_toothbrushing` +
`4_Frequency_of_dentist_visits_in_last_12_months` +
`7_Frequency_of_dental_hygienist_visits` +
`11_Usage_of_fluoride_supplements` +
`13_Eating_habits_grouped` +
SUMA_TSP_Sugar,
data = df.log,
family = binomial)
summary(d3)
summary(d4)
stargazer(d3, d4, type="text", digits=3,
dep.var.labels=c("Caries at D3 (= 1)"),
covariate.labels=c("Sex (male = 1)",
"FAS (Low = 1)",
"Freq Toothbrushing ( < once per week = 1)",
"Freq visit dentist ( < once per year = 1)",
"Freq visit hygienist ( < once per year = 1)",
"Dental floss (no use = 1)",
"Mouthwash (no use = 1)",
"Use of fluoride supplement (no use = 1)",
"Eating habits (high in sweet = 1)",
"More than one teaspoon in tea, coffee or cacao"),
out="modelsD3.txt")
citation("tidyverse")
citation("lubridate") #for dates
citation()
write.foreign(df, "dataset_oralHealth_LV_spss.txt", "dataset_oralHealth_LV_spss.sps", package="SPSS")