Read in the data from the .txt file, Since this file was difficult to read a clean up was conducted.

gut <- readLines("~/Desktop/BIN512L-assignments/biosample_result (1).txt")
check <- grep("^Attributes:", gut)
attributes <- gut[(check + 1):length(gut)]
attributes <- trimws(attributes)
attributes <- strsplit(attributes, "\t")

Turned the cleaned up data into a dataframe, and continued to clean up any unwanted data.

survey <- do.call(rbind, attributes)
survey <- as.data.frame(survey, stringsAsFactors = FALSE)
colnames(survey) <- c("variable", "value")
survey$variable <- sub("/", "", survey$variable)
survey <- survey[-(1:10), ]
survey2 <- as.data.frame(t(survey$value))
colnames(survey2) <- survey$variable
survey2
##                    acid_reflux acne_medication acne_medication_otc
## 1 i do not have this condition              no                  no
##                       add_adhd age_cat alcohol_consumption
## 1 i do not have this condition     30s                 yes
##               alcohol_frequency alcohol_types_beercider alcohol_types_red_wine
## 1 occasionally (1-2 times/week)                    TRUE                   TRUE
##   alcohol_types_sour_beers alcohol_types_spiritshard_alcohol
## 1                     TRUE                              TRUE
##   alcohol_types_unspecified alcohol_types_white_wine
## 1                     FALSE                    FALSE
##   allergic_to_i_have_no_food_allergies_that_i_know_of allergic_to_peanuts
## 1                                               FALSE               FALSE
##   allergic_to_shellfish allergic_to_tree_nuts allergic_to_unspecified
## 1                 FALSE                 FALSE                   FALSE
##                     alzheimers anonymized_name antibiotic_history
## 1 i do not have this condition       X00185902               year
##   appendix_removed      artificial_sweeteners                          asd
## 1               no rarely (a few times/month) i do not have this condition
##                     autoimmune               beet_frequency birth_year
## 1 i do not have this condition rarely (less than once/week)       1990
##      bmi_cat bowel_movement_frequency
## 1 overweight                      one
##                              bowel_movement_quality breastmilk_formula_ensure
## 1 i tend to have normal formed stool - type 3 and 4                        no
##                         cancer       cardiovascular_disease cat
## 1 i do not have this condition i do not have this condition  no
##                          cdiff chickenpox           clinical_condition
## 1 i do not have this condition        yes i do not have this condition
##   collection_timestamp consume_animal_products_abx contraceptive
## 1          1.60803E+12                    not sure            no
##   cosmetics_frequency country_of_birth country_residence covid_anxious
## 1               never            china     united states    not at all
##   covid_chronic_conditions_any_autoimmune_disease
## 1                                           FALSE
##   covid_chronic_conditions_arthritis
## 1                              FALSE
##   covid_chronic_conditions_asthma_or_other_lung_problems
## 1                                                  FALSE
##   covid_chronic_conditions_atrial_fibrillation_or_atrial_flutter
## 1                                                          FALSE
##   covid_chronic_conditions_cancer
## 1                           FALSE
##   covid_chronic_conditions_chronic_obstructive_pulmonary_disease_copd
## 1                                                               FALSE
##   covid_chronic_conditions_congestive_heart_failure
## 1                                             FALSE
##   covid_chronic_conditions_deep_vein_thrombosis
## 1                                         FALSE
##   covid_chronic_conditions_diabetes_or_high_blood_sugar
## 1                                                 FALSE
##   covid_chronic_conditions_epilepsy_or_seizures
## 1                                         FALSE
##   covid_chronic_conditions_frequent_or_very_bad_headaches
## 1                                                   FALSE
##   covid_chronic_conditions_heart_disease__myocardial_infarction
## 1                                                         FALSE
##   covid_chronic_conditions_heart_problems covid_chronic_conditions_hiv
## 1                                   FALSE                        FALSE
##   covid_chronic_conditions_hypertension
## 1                                 FALSE
##   covid_chronic_conditions_immune_disorder
## 1                                    FALSE
##   covid_chronic_conditions_kidney_problems
## 1                                    FALSE
##   covid_chronic_conditions_pulmonary_embolism
## 1                                       FALSE
##   covid_chronic_conditions_seasonal_allergies
## 1                                       FALSE
##   covid_chronic_conditions_serious_acne_or_skin_problems
## 1                                                  FALSE
##   covid_chronic_conditions_serious_stomach_or_bowel_problems
## 1                                                      FALSE
##   covid_chronic_conditions_stroke covid_chronic_conditions_unspecified
## 1                           FALSE                                FALSE
##   covid_depressed covid_difficulty_staying_asleep
## 1      not at all                            mild
##   covid_family_members_fallen_ill_physically covid_family_members_hospitalized
## 1                                      FALSE                             FALSE
##   covid_family_members_lost_job covid_family_members_none_of_the_above
## 1                         FALSE                                  FALSE
##   covid_family_members_passed_away
## 1                            FALSE
##   covid_family_members_put_into_self_quarantine_with_symptoms
## 1                                                       FALSE
##   covid_family_members_put_into_self_quarantine_without_symptoms_eg_due_to_possible_exposure
## 1                                                                                      FALSE
##   covid_family_members_reduced_ability_to_earn_money
## 1                                              FALSE
##   covid_family_members_unspecified covid_happened_to_you_fallen_ill_physically
## 1                            FALSE                                       FALSE
##   covid_happened_to_you_hospitalized covid_happened_to_you_lost_job
## 1                              FALSE                          FALSE
##   covid_happened_to_you_none_of_the_above
## 1                                   FALSE
##   covid_happened_to_you_put_into_self_quarantine_with_symptoms
## 1                                                        FALSE
##   covid_happened_to_you_put_into_self_quarantine_without_symptoms_eg_due_to_possible_exposure
## 1                                                                                       FALSE
##   covid_happened_to_you_reduced_ability_to_earn_money
## 1                                               FALSE
##   covid_happened_to_you_unspecified covid_interest_pleasure
## 1                             FALSE              not at all
##         covid_left_home covid_level_of_wellbeing covid_likely_exposure_no
## 1 several days per week                very good                     TRUE
##   covid_likely_exposure_unspecified
## 1                             FALSE
##   covid_likely_exposure_yes_someone_with_medical_diagnosis_but_no_test
## 1                                                                FALSE
##   covid_likely_exposure_yes_someone_with_positive_test
## 1                                                FALSE
##   covid_likely_exposure_yes_someone_with_possible_symptoms_but_no_diagnosis_by_doctor
## 1                                                                               FALSE
##   covid_patient_care covid_quality_of_life covid_rideshare
## 1                 no     barely noticeable             yes
##   covid_sleep_interference covid_sleep_pattern covid_suspected_positive
## 1              interfering           satisfied     no symptoms or signs
##   covid_symptoms_chest_pain_or_tightness_in_chest covid_symptoms_cough
## 1                                           FALSE                FALSE
##   covid_symptoms_diarrhea covid_symptoms_fatigue covid_symptoms_fever
## 1                   FALSE                  FALSE                FALSE
##   covid_symptoms_lack_of_appetitie covid_symptoms_loss_of_taste_or_smell
## 1                            FALSE                                 FALSE
##   covid_symptoms_nausea covid_symptoms_shortness_of_breath
## 1                 FALSE                              FALSE
##   covid_symptoms_sore_throat covid_symptoms_unspecified covid_waking_up_early
## 1                      FALSE                      FALSE                  mild
##   covid_worried_sleep covid_worrying csection   deodorant_use
## 1    a little worried     not at all       no i use deodorant
##                       diabetes diet_type dna_extracted dog     dominant hand
## 1 i do not have this condition  omnivore          TRUE  no i am right handed
##   drinking_water_source drinks_per_session          empo_1 empo_2
## 1              filtered              4-Mar host-associated animal
##              empo_3 broad-scale environmental context
## 1 animal distal gut            dense settlement biome
##   local-scale environmental context environmental medium environmental package
## 1          human-associated habitat                feces             human-gut
##   epilepsy_or_seizure_disorder         exercise_frequency exercise_location
## 1 i do not have this condition regularly (3-5 times/week)              both
##                          fed_as_infant fermented_consumed_beer
## 1 a mixture of breast milk and formula                   FALSE
##   fermented_consumed_chicha fermented_consumed_cider
## 1                     FALSE                    FALSE
##   fermented_consumed_cottage_cheese fermented_consumed_fermented_beansmisonatto
## 1                             FALSE                                       FALSE
##   fermented_consumed_fermented_breadsourdoughinjera
## 1                                             FALSE
##   fermented_consumed_fermented_fish fermented_consumed_fermented_tofu
## 1                             FALSE                             FALSE
##   fermented_consumed_fish_sauce fermented_consumed_kefir_milk
## 1                         FALSE                         FALSE
##   fermented_consumed_kefir_water fermented_consumed_kimchi
## 1                          FALSE                     FALSE
##   fermented_consumed_kombucha fermented_consumed_mead
## 1                       FALSE                   FALSE
##   fermented_consumed_pickled_vegetables fermented_consumed_sauerkraut
## 1                                 FALSE                         FALSE
##   fermented_consumed_sour_creamcreme_fraiche fermented_consumed_tempeh
## 1                                      FALSE                     FALSE
##   fermented_consumed_unspecified fermented_consumed_wine
## 1                          FALSE                   FALSE
##   fermented_consumed_yogurtlassi     fermented_plant_frequency
## 1                          FALSE occasionally (1-2 times/week)
##   fermented_produce_commercial_beer fermented_produce_commercial_chicha
## 1                             FALSE                               FALSE
##   fermented_produce_commercial_cider
## 1                              FALSE
##   fermented_produce_commercial_cottage_cheese
## 1                                       FALSE
##   fermented_produce_commercial_fermented_beansmisonatto
## 1                                                 FALSE
##   fermented_produce_commercial_fermented_breadsourdoughinjera
## 1                                                       FALSE
##   fermented_produce_commercial_fermented_fish
## 1                                       FALSE
##   fermented_produce_commercial_fermented_tofu
## 1                                       FALSE
##   fermented_produce_commercial_fish_sauce
## 1                                   FALSE
##   fermented_produce_commercial_kefir_milk
## 1                                   FALSE
##   fermented_produce_commercial_kefir_water fermented_produce_commercial_kimchi
## 1                                    FALSE                               FALSE
##   fermented_produce_commercial_kombucha fermented_produce_commercial_mead
## 1                                 FALSE                             FALSE
##   fermented_produce_commercial_pickled_vegetables
## 1                                           FALSE
##   fermented_produce_commercial_sauerkraut
## 1                                   FALSE
##   fermented_produce_commercial_sour_creamcreme_fraiche
## 1                                                FALSE
##   fermented_produce_commercial_tempeh fermented_produce_commercial_unspecified
## 1                               FALSE                                    FALSE
##   fermented_produce_commercial_wine fermented_produce_commercial_yogurtlassi
## 1                             FALSE                                    FALSE
##   fermented_produce_personal_beer fermented_produce_personal_chicha
## 1                           FALSE                             FALSE
##   fermented_produce_personal_cider fermented_produce_personal_cottage_cheese
## 1                            FALSE                                     FALSE
##   fermented_produce_personal_fermented_beansmisonatto
## 1                                               FALSE
##   fermented_produce_personal_fermented_breadsourdoughinjera
## 1                                                     FALSE
##   fermented_produce_personal_fermented_fish
## 1                                     FALSE
##   fermented_produce_personal_fermented_tofu
## 1                                     FALSE
##   fermented_produce_personal_fish_sauce fermented_produce_personal_kefir_milk
## 1                                 FALSE                                 FALSE
##   fermented_produce_personal_kefir_water fermented_produce_personal_kimchi
## 1                                  FALSE                             FALSE
##   fermented_produce_personal_kombucha fermented_produce_personal_mead
## 1                               FALSE                           FALSE
##   fermented_produce_personal_pickled_vegetables
## 1                                         FALSE
##   fermented_produce_personal_sauerkraut
## 1                                 FALSE
##   fermented_produce_personal_sour_creamcreme_fraiche
## 1                                              FALSE
##   fermented_produce_personal_tempeh fermented_produce_personal_unspecified
## 1                             FALSE                                  FALSE
##   fermented_produce_personal_wine fermented_produce_personal_yogurtlassi
## 1                           FALSE                                  FALSE
##   flossing_frequency flu_vaccine_date food_source_human_food
## 1              daily            month                  FALSE
##   food_source_pet_store_food food_source_unspecified food_source_wild_food
## 1                      FALSE                   FALSE                 FALSE
##   food_special_grain_free food_special_organic food_special_unspecified
## 1                   FALSE                FALSE                    FALSE
##        frozen_dessert_frequency               fruit_frequency
## 1 occasionally (1-2 times/week) occasionally (1-2 times/week)
##              fungal_overgrowth gluten  high_fat_red_meat_frequency
## 1 i do not have this condition     no rarely (less than once/week)
##   homecooked_meals_frequency host age host_age_normalized_years
## 1                      daily     30.3                      30.3
##   host body habitat host body mass index host body product host tissue sampled
## 1      uberon:feces                 29.2      uberon:feces        uberon:feces
##   host common name host height host_height_units
## 1            human         175                cm
##                                                                                                                        host subject id
## 1 ['82ac58c085b81ce5bdacb775910b2a31e40ed1fc8b00558b6f55f50d4f768f74af3333a8accd9fa196d2ba8a9ca63874a2493047029ce7b5b44816e03e1f052c']
##   host taxonomy ID host_weight host_weight_units                          ibd
## 1             9606 89.35780316                kg i do not have this condition
##                            ibs               kidney_disease lactose
## 1 i do not have this condition i do not have this condition      no
##                                                             last_move
## 1 i have lived in my current state of residence for more than a year.
##   last_travel level_of_education life stage                liver_disease
## 1      1 year  bachelor's degree      adult i do not have this condition
##   livingwith                 lung_disease meat_eggs_frequency mental_illness
## 1        yes i do not have this condition               daily             no
##   mental_illness_type_anorexia_nervosa mental_illness_type_bipolar_disorder
## 1                                FALSE                                FALSE
##   mental_illness_type_bulimia_nervosa mental_illness_type_depression
## 1                               FALSE                          FALSE
##   mental_illness_type_ptsd_post_traumatic_stress_disorder
## 1                                                   FALSE
##   mental_illness_type_schizophrenia mental_illness_type_substance_abuse
## 1                             FALSE                               FALSE
##   mental_illness_type_unspecified                     migraine
## 1                           FALSE i do not have this condition
##           milk_cheese_frequency    milk_substitute_frequency multivitamin
## 1 occasionally (1-2 times/week) rarely (less than once/week)           no
##   nail_biter non_food_allergies_beestings non_food_allergies_drug_eg_penicillin
## 1         no                        FALSE                                 FALSE
##   non_food_allergies_pet_dander non_food_allergies_poison_ivyoak
## 1                         FALSE                            FALSE
##   non_food_allergies_sun non_food_allergies_unspecified
## 1                  FALSE                          FALSE
##                      olive_oil one_liter_of_water_a_day_frequency
## 1 rarely (less than once/week)                              daily
##   other_supplement_frequency pets_other physical_specimen_location
## 1                         no         no                     ucsdmi
##   physical_specimen_remaining                          pku
## 1                         yes i do not have this condition
##         plant_protein_frequency             pool_frequency
## 1 occasionally (1-2 times/week) rarely (a few times/month)
##            poultry_frequency pregnant   prepared_meals_frequency
## 1 regularly (3-5 times/week)       no regularly (3-5 times/week)
##          probiotic_frequency public                      race
## 1 rarely (a few times/month)   TRUE asian or pacific islander
##   ready_to_eat_meals_frequency         red_meat_frequency roommates_in_study
## 1   regularly (3-5 times/week) regularly (3-5 times/week)                 no
##         salted_snacks_frequency                     sample name sample type
## 1 occasionally (1-2 times/week) qiita_sid_10317:10317.X00185902       stool
##        scientific_name          seafood_frequency seasonal_allergies  sex
## 1 human gut metagenome regularly (3-5 times/week)                 no male
##                           sibo               skin_condition sleep_duration
## 1 i do not have this condition i do not have this condition      7-8 hours
##            smoking_frequency softener specialized_diet_exclude_dairy
## 1 rarely (a few times/month)      yes                          FALSE
##   specialized_diet_exclude_nightshades specialized_diet_exclude_refined_sugars
## 1                                FALSE                                   FALSE
##   specialized_diet_fodmap specialized_diet_halaal
## 1                   FALSE                   FALSE
##   specialized_diet_i_do_not_eat_a_specialized_diet specialized_diet_kosher
## 1                                             TRUE                   FALSE
##   specialized_diet_modified_paleo_diet
## 1                                FALSE
##   specialized_diet_other_restrictions_not_described_here
## 1                                                  FALSE
##   specialized_diet_paleo_diet_or_primal_diet specialized_diet_raw_food_diet
## 1                                      FALSE                          FALSE
##   specialized_diet_unspecified
## 1                        FALSE
##   specialized_diet_weston_price_or_other_low_grain_low_processed_food_diet
## 1                                                                    FALSE
##   sugar_sweetened_drink_frequency       sugary_sweets_frequency
## 1    rarely (less than once/week) occasionally (1-2 times/week)
##   teethbrushing_frequency                      thyroid tonsils_removed
## 1                   daily i do not have this condition              no
##   types_of_plants        vegetable_frequency vitamin_b_supplement_frequency
## 1         6 to 10 regularly (3-5 times/week)                          never
##   vitamin_d_supplement_frequency               vivid_dreams
## 1                          never rarely (a few times/month)
##                   weight_change                   whole_eggs
## 1 increased more than 10 pounds rarely (less than once/week)
##           whole_grain_frequency Description: american gut project stool sample
## 1 occasionally (1-2 times/week) Description: american gut project stool sample
##   Accession: SAMEA112990854
## 1              ID: 34470136
colnames(survey2)
##   [1] "acid_reflux"                                                                                
##   [2] "acne_medication"                                                                            
##   [3] "acne_medication_otc"                                                                        
##   [4] "add_adhd"                                                                                   
##   [5] "age_cat"                                                                                    
##   [6] "alcohol_consumption"                                                                        
##   [7] "alcohol_frequency"                                                                          
##   [8] "alcohol_types_beercider"                                                                    
##   [9] "alcohol_types_red_wine"                                                                     
##  [10] "alcohol_types_sour_beers"                                                                   
##  [11] "alcohol_types_spiritshard_alcohol"                                                          
##  [12] "alcohol_types_unspecified"                                                                  
##  [13] "alcohol_types_white_wine"                                                                   
##  [14] "allergic_to_i_have_no_food_allergies_that_i_know_of"                                        
##  [15] "allergic_to_peanuts"                                                                        
##  [16] "allergic_to_shellfish"                                                                      
##  [17] "allergic_to_tree_nuts"                                                                      
##  [18] "allergic_to_unspecified"                                                                    
##  [19] "alzheimers"                                                                                 
##  [20] "anonymized_name"                                                                            
##  [21] "antibiotic_history"                                                                         
##  [22] "appendix_removed"                                                                           
##  [23] "artificial_sweeteners"                                                                      
##  [24] "asd"                                                                                        
##  [25] "autoimmune"                                                                                 
##  [26] "beet_frequency"                                                                             
##  [27] "birth_year"                                                                                 
##  [28] "bmi_cat"                                                                                    
##  [29] "bowel_movement_frequency"                                                                   
##  [30] "bowel_movement_quality"                                                                     
##  [31] "breastmilk_formula_ensure"                                                                  
##  [32] "cancer"                                                                                     
##  [33] "cardiovascular_disease"                                                                     
##  [34] "cat"                                                                                        
##  [35] "cdiff"                                                                                      
##  [36] "chickenpox"                                                                                 
##  [37] "clinical_condition"                                                                         
##  [38] "collection_timestamp"                                                                       
##  [39] "consume_animal_products_abx"                                                                
##  [40] "contraceptive"                                                                              
##  [41] "cosmetics_frequency"                                                                        
##  [42] "country_of_birth"                                                                           
##  [43] "country_residence"                                                                          
##  [44] "covid_anxious"                                                                              
##  [45] "covid_chronic_conditions_any_autoimmune_disease"                                            
##  [46] "covid_chronic_conditions_arthritis"                                                         
##  [47] "covid_chronic_conditions_asthma_or_other_lung_problems"                                     
##  [48] "covid_chronic_conditions_atrial_fibrillation_or_atrial_flutter"                             
##  [49] "covid_chronic_conditions_cancer"                                                            
##  [50] "covid_chronic_conditions_chronic_obstructive_pulmonary_disease_copd"                        
##  [51] "covid_chronic_conditions_congestive_heart_failure"                                          
##  [52] "covid_chronic_conditions_deep_vein_thrombosis"                                              
##  [53] "covid_chronic_conditions_diabetes_or_high_blood_sugar"                                      
##  [54] "covid_chronic_conditions_epilepsy_or_seizures"                                              
##  [55] "covid_chronic_conditions_frequent_or_very_bad_headaches"                                    
##  [56] "covid_chronic_conditions_heart_disease__myocardial_infarction"                              
##  [57] "covid_chronic_conditions_heart_problems"                                                    
##  [58] "covid_chronic_conditions_hiv"                                                               
##  [59] "covid_chronic_conditions_hypertension"                                                      
##  [60] "covid_chronic_conditions_immune_disorder"                                                   
##  [61] "covid_chronic_conditions_kidney_problems"                                                   
##  [62] "covid_chronic_conditions_pulmonary_embolism"                                                
##  [63] "covid_chronic_conditions_seasonal_allergies"                                                
##  [64] "covid_chronic_conditions_serious_acne_or_skin_problems"                                     
##  [65] "covid_chronic_conditions_serious_stomach_or_bowel_problems"                                 
##  [66] "covid_chronic_conditions_stroke"                                                            
##  [67] "covid_chronic_conditions_unspecified"                                                       
##  [68] "covid_depressed"                                                                            
##  [69] "covid_difficulty_staying_asleep"                                                            
##  [70] "covid_family_members_fallen_ill_physically"                                                 
##  [71] "covid_family_members_hospitalized"                                                          
##  [72] "covid_family_members_lost_job"                                                              
##  [73] "covid_family_members_none_of_the_above"                                                     
##  [74] "covid_family_members_passed_away"                                                           
##  [75] "covid_family_members_put_into_self_quarantine_with_symptoms"                                
##  [76] "covid_family_members_put_into_self_quarantine_without_symptoms_eg_due_to_possible_exposure" 
##  [77] "covid_family_members_reduced_ability_to_earn_money"                                         
##  [78] "covid_family_members_unspecified"                                                           
##  [79] "covid_happened_to_you_fallen_ill_physically"                                                
##  [80] "covid_happened_to_you_hospitalized"                                                         
##  [81] "covid_happened_to_you_lost_job"                                                             
##  [82] "covid_happened_to_you_none_of_the_above"                                                    
##  [83] "covid_happened_to_you_put_into_self_quarantine_with_symptoms"                               
##  [84] "covid_happened_to_you_put_into_self_quarantine_without_symptoms_eg_due_to_possible_exposure"
##  [85] "covid_happened_to_you_reduced_ability_to_earn_money"                                        
##  [86] "covid_happened_to_you_unspecified"                                                          
##  [87] "covid_interest_pleasure"                                                                    
##  [88] "covid_left_home"                                                                            
##  [89] "covid_level_of_wellbeing"                                                                   
##  [90] "covid_likely_exposure_no"                                                                   
##  [91] "covid_likely_exposure_unspecified"                                                          
##  [92] "covid_likely_exposure_yes_someone_with_medical_diagnosis_but_no_test"                       
##  [93] "covid_likely_exposure_yes_someone_with_positive_test"                                       
##  [94] "covid_likely_exposure_yes_someone_with_possible_symptoms_but_no_diagnosis_by_doctor"        
##  [95] "covid_patient_care"                                                                         
##  [96] "covid_quality_of_life"                                                                      
##  [97] "covid_rideshare"                                                                            
##  [98] "covid_sleep_interference"                                                                   
##  [99] "covid_sleep_pattern"                                                                        
## [100] "covid_suspected_positive"                                                                   
## [101] "covid_symptoms_chest_pain_or_tightness_in_chest"                                            
## [102] "covid_symptoms_cough"                                                                       
## [103] "covid_symptoms_diarrhea"                                                                    
## [104] "covid_symptoms_fatigue"                                                                     
## [105] "covid_symptoms_fever"                                                                       
## [106] "covid_symptoms_lack_of_appetitie"                                                           
## [107] "covid_symptoms_loss_of_taste_or_smell"                                                      
## [108] "covid_symptoms_nausea"                                                                      
## [109] "covid_symptoms_shortness_of_breath"                                                         
## [110] "covid_symptoms_sore_throat"                                                                 
## [111] "covid_symptoms_unspecified"                                                                 
## [112] "covid_waking_up_early"                                                                      
## [113] "covid_worried_sleep"                                                                        
## [114] "covid_worrying"                                                                             
## [115] "csection"                                                                                   
## [116] "deodorant_use"                                                                              
## [117] "diabetes"                                                                                   
## [118] "diet_type"                                                                                  
## [119] "dna_extracted"                                                                              
## [120] "dog"                                                                                        
## [121] "dominant hand"                                                                              
## [122] "drinking_water_source"                                                                      
## [123] "drinks_per_session"                                                                         
## [124] "empo_1"                                                                                     
## [125] "empo_2"                                                                                     
## [126] "empo_3"                                                                                     
## [127] "broad-scale environmental context"                                                          
## [128] "local-scale environmental context"                                                          
## [129] "environmental medium"                                                                       
## [130] "environmental package"                                                                      
## [131] "epilepsy_or_seizure_disorder"                                                               
## [132] "exercise_frequency"                                                                         
## [133] "exercise_location"                                                                          
## [134] "fed_as_infant"                                                                              
## [135] "fermented_consumed_beer"                                                                    
## [136] "fermented_consumed_chicha"                                                                  
## [137] "fermented_consumed_cider"                                                                   
## [138] "fermented_consumed_cottage_cheese"                                                          
## [139] "fermented_consumed_fermented_beansmisonatto"                                                
## [140] "fermented_consumed_fermented_breadsourdoughinjera"                                          
## [141] "fermented_consumed_fermented_fish"                                                          
## [142] "fermented_consumed_fermented_tofu"                                                          
## [143] "fermented_consumed_fish_sauce"                                                              
## [144] "fermented_consumed_kefir_milk"                                                              
## [145] "fermented_consumed_kefir_water"                                                             
## [146] "fermented_consumed_kimchi"                                                                  
## [147] "fermented_consumed_kombucha"                                                                
## [148] "fermented_consumed_mead"                                                                    
## [149] "fermented_consumed_pickled_vegetables"                                                      
## [150] "fermented_consumed_sauerkraut"                                                              
## [151] "fermented_consumed_sour_creamcreme_fraiche"                                                 
## [152] "fermented_consumed_tempeh"                                                                  
## [153] "fermented_consumed_unspecified"                                                             
## [154] "fermented_consumed_wine"                                                                    
## [155] "fermented_consumed_yogurtlassi"                                                             
## [156] "fermented_plant_frequency"                                                                  
## [157] "fermented_produce_commercial_beer"                                                          
## [158] "fermented_produce_commercial_chicha"                                                        
## [159] "fermented_produce_commercial_cider"                                                         
## [160] "fermented_produce_commercial_cottage_cheese"                                                
## [161] "fermented_produce_commercial_fermented_beansmisonatto"                                      
## [162] "fermented_produce_commercial_fermented_breadsourdoughinjera"                                
## [163] "fermented_produce_commercial_fermented_fish"                                                
## [164] "fermented_produce_commercial_fermented_tofu"                                                
## [165] "fermented_produce_commercial_fish_sauce"                                                    
## [166] "fermented_produce_commercial_kefir_milk"                                                    
## [167] "fermented_produce_commercial_kefir_water"                                                   
## [168] "fermented_produce_commercial_kimchi"                                                        
## [169] "fermented_produce_commercial_kombucha"                                                      
## [170] "fermented_produce_commercial_mead"                                                          
## [171] "fermented_produce_commercial_pickled_vegetables"                                            
## [172] "fermented_produce_commercial_sauerkraut"                                                    
## [173] "fermented_produce_commercial_sour_creamcreme_fraiche"                                       
## [174] "fermented_produce_commercial_tempeh"                                                        
## [175] "fermented_produce_commercial_unspecified"                                                   
## [176] "fermented_produce_commercial_wine"                                                          
## [177] "fermented_produce_commercial_yogurtlassi"                                                   
## [178] "fermented_produce_personal_beer"                                                            
## [179] "fermented_produce_personal_chicha"                                                          
## [180] "fermented_produce_personal_cider"                                                           
## [181] "fermented_produce_personal_cottage_cheese"                                                  
## [182] "fermented_produce_personal_fermented_beansmisonatto"                                        
## [183] "fermented_produce_personal_fermented_breadsourdoughinjera"                                  
## [184] "fermented_produce_personal_fermented_fish"                                                  
## [185] "fermented_produce_personal_fermented_tofu"                                                  
## [186] "fermented_produce_personal_fish_sauce"                                                      
## [187] "fermented_produce_personal_kefir_milk"                                                      
## [188] "fermented_produce_personal_kefir_water"                                                     
## [189] "fermented_produce_personal_kimchi"                                                          
## [190] "fermented_produce_personal_kombucha"                                                        
## [191] "fermented_produce_personal_mead"                                                            
## [192] "fermented_produce_personal_pickled_vegetables"                                              
## [193] "fermented_produce_personal_sauerkraut"                                                      
## [194] "fermented_produce_personal_sour_creamcreme_fraiche"                                         
## [195] "fermented_produce_personal_tempeh"                                                          
## [196] "fermented_produce_personal_unspecified"                                                     
## [197] "fermented_produce_personal_wine"                                                            
## [198] "fermented_produce_personal_yogurtlassi"                                                     
## [199] "flossing_frequency"                                                                         
## [200] "flu_vaccine_date"                                                                           
## [201] "food_source_human_food"                                                                     
## [202] "food_source_pet_store_food"                                                                 
## [203] "food_source_unspecified"                                                                    
## [204] "food_source_wild_food"                                                                      
## [205] "food_special_grain_free"                                                                    
## [206] "food_special_organic"                                                                       
## [207] "food_special_unspecified"                                                                   
## [208] "frozen_dessert_frequency"                                                                   
## [209] "fruit_frequency"                                                                            
## [210] "fungal_overgrowth"                                                                          
## [211] "gluten"                                                                                     
## [212] "high_fat_red_meat_frequency"                                                                
## [213] "homecooked_meals_frequency"                                                                 
## [214] "host age"                                                                                   
## [215] "host_age_normalized_years"                                                                  
## [216] "host body habitat"                                                                          
## [217] "host body mass index"                                                                       
## [218] "host body product"                                                                          
## [219] "host tissue sampled"                                                                        
## [220] "host common name"                                                                           
## [221] "host height"                                                                                
## [222] "host_height_units"                                                                          
## [223] "host subject id"                                                                            
## [224] "host taxonomy ID"                                                                           
## [225] "host_weight"                                                                                
## [226] "host_weight_units"                                                                          
## [227] "ibd"                                                                                        
## [228] "ibs"                                                                                        
## [229] "kidney_disease"                                                                             
## [230] "lactose"                                                                                    
## [231] "last_move"                                                                                  
## [232] "last_travel"                                                                                
## [233] "level_of_education"                                                                         
## [234] "life stage"                                                                                 
## [235] "liver_disease"                                                                              
## [236] "livingwith"                                                                                 
## [237] "lung_disease"                                                                               
## [238] "meat_eggs_frequency"                                                                        
## [239] "mental_illness"                                                                             
## [240] "mental_illness_type_anorexia_nervosa"                                                       
## [241] "mental_illness_type_bipolar_disorder"                                                       
## [242] "mental_illness_type_bulimia_nervosa"                                                        
## [243] "mental_illness_type_depression"                                                             
## [244] "mental_illness_type_ptsd_post_traumatic_stress_disorder"                                    
## [245] "mental_illness_type_schizophrenia"                                                          
## [246] "mental_illness_type_substance_abuse"                                                        
## [247] "mental_illness_type_unspecified"                                                            
## [248] "migraine"                                                                                   
## [249] "milk_cheese_frequency"                                                                      
## [250] "milk_substitute_frequency"                                                                  
## [251] "multivitamin"                                                                               
## [252] "nail_biter"                                                                                 
## [253] "non_food_allergies_beestings"                                                               
## [254] "non_food_allergies_drug_eg_penicillin"                                                      
## [255] "non_food_allergies_pet_dander"                                                              
## [256] "non_food_allergies_poison_ivyoak"                                                           
## [257] "non_food_allergies_sun"                                                                     
## [258] "non_food_allergies_unspecified"                                                             
## [259] "olive_oil"                                                                                  
## [260] "one_liter_of_water_a_day_frequency"                                                         
## [261] "other_supplement_frequency"                                                                 
## [262] "pets_other"                                                                                 
## [263] "physical_specimen_location"                                                                 
## [264] "physical_specimen_remaining"                                                                
## [265] "pku"                                                                                        
## [266] "plant_protein_frequency"                                                                    
## [267] "pool_frequency"                                                                             
## [268] "poultry_frequency"                                                                          
## [269] "pregnant"                                                                                   
## [270] "prepared_meals_frequency"                                                                   
## [271] "probiotic_frequency"                                                                        
## [272] "public"                                                                                     
## [273] "race"                                                                                       
## [274] "ready_to_eat_meals_frequency"                                                               
## [275] "red_meat_frequency"                                                                         
## [276] "roommates_in_study"                                                                         
## [277] "salted_snacks_frequency"                                                                    
## [278] "sample name"                                                                                
## [279] "sample type"                                                                                
## [280] "scientific_name"                                                                            
## [281] "seafood_frequency"                                                                          
## [282] "seasonal_allergies"                                                                         
## [283] "sex"                                                                                        
## [284] "sibo"                                                                                       
## [285] "skin_condition"                                                                             
## [286] "sleep_duration"                                                                             
## [287] "smoking_frequency"                                                                          
## [288] "softener"                                                                                   
## [289] "specialized_diet_exclude_dairy"                                                             
## [290] "specialized_diet_exclude_nightshades"                                                       
## [291] "specialized_diet_exclude_refined_sugars"                                                    
## [292] "specialized_diet_fodmap"                                                                    
## [293] "specialized_diet_halaal"                                                                    
## [294] "specialized_diet_i_do_not_eat_a_specialized_diet"                                           
## [295] "specialized_diet_kosher"                                                                    
## [296] "specialized_diet_modified_paleo_diet"                                                       
## [297] "specialized_diet_other_restrictions_not_described_here"                                     
## [298] "specialized_diet_paleo_diet_or_primal_diet"                                                 
## [299] "specialized_diet_raw_food_diet"                                                             
## [300] "specialized_diet_unspecified"                                                               
## [301] "specialized_diet_weston_price_or_other_low_grain_low_processed_food_diet"                   
## [302] "sugar_sweetened_drink_frequency"                                                            
## [303] "sugary_sweets_frequency"                                                                    
## [304] "teethbrushing_frequency"                                                                    
## [305] "thyroid"                                                                                    
## [306] "tonsils_removed"                                                                            
## [307] "types_of_plants"                                                                            
## [308] "vegetable_frequency"                                                                        
## [309] "vitamin_b_supplement_frequency"                                                             
## [310] "vitamin_d_supplement_frequency"                                                             
## [311] "vivid_dreams"                                                                               
## [312] "weight_change"                                                                              
## [313] "whole_eggs"                                                                                 
## [314] "whole_grain_frequency"                                                                      
## [315] "Description:"                                                                               
## [316] "american gut project stool sample"                                                          
## [317] "Accession: SAMEA112990854"

Choose which data to keep and which data to omit.

keep <- c("age_cat", "bmi_cat", "bowel_movement_frequency",
          "bowel_movement_quality", "antibiotic_history",
          "diet_type", "exercise_frequency", "probiotic_frequency",
          "fruit_frequency", "vegetable_frequency", "meat_eggs_frequency",
          "milk_cheese_frequency", "smoking_frequency", "sex",
          "sample type")
survey_final <- survey2[, keep]

Created a final csv file of the cleaned/titled data.

write.csv(survey_final, "American_Gut_cleaned.csv", row.names = FALSE)
head(survey_final)
##   age_cat    bmi_cat bowel_movement_frequency
## 1     30s overweight                      one
##                              bowel_movement_quality antibiotic_history
## 1 i tend to have normal formed stool - type 3 and 4               year
##   diet_type         exercise_frequency        probiotic_frequency
## 1  omnivore regularly (3-5 times/week) rarely (a few times/month)
##                 fruit_frequency        vegetable_frequency meat_eggs_frequency
## 1 occasionally (1-2 times/week) regularly (3-5 times/week)               daily
##           milk_cheese_frequency          smoking_frequency  sex sample type
## 1 occasionally (1-2 times/week) rarely (a few times/month) male       stool