DATA607 Assignment 1 Report


Introduction

The article that I chose to read on 538 is called “What Do Men Think It Means To Be A Man?”. The article is related to what men think about masculinity in light of the #MeToo movement and societal pressure on gender roles. The data used in the article is actually a survey in which 1600 men took part in to answer questions related to masculinity across multiple dimensions include:

  • male identity
  • concerns & worries
  • men at work
  • dating & relationships

Based on my assessment of the article, I was curious to learn more about how men in the survey felt when it comes to concerns regarding their physical health as that’s an important factor to me.


Solution

Reading the Data

Before investigating the question of interest to me, I wanted to get a quick preview of the survey data that FiveThirtyEight used in the article. In order to obtain this data, I managed to find an associated .csv file linked on the FiveThirtyEight article page on the website which redirected me to a GitHub repository.

# Load the survey data from 538
url <- "https://raw.githubusercontent.com/fivethirtyeight/data/refs/heads/master/masculinity-survey/masculinity-survey.csv"

# Create a DataFrame from the URL
df <- read.csv(url)

head(df)
##                                     AMONG.ADULT.MEN                    X
## 1                                                                       
## 2 In general, how masculine or "manly" do you feel?                     
## 3                                                         Very masculine
## 4                                                     Somewhat masculine
## 5                                                     Not very masculine
## 6                                                   Not at all masculine
##   Adult.Men     Age     X.1       X.2  Race       X.3     Children         X.4
## 1           18 - 34 35 - 64 65 and up White Non-white Has children No children
## 2                                                                             
## 3       37%     29%     42%       37%   34%       44%          43%         30%
## 4       46%     47%     46%       47%   50%       39%          47%         46%
## 5       11%     13%      9%       13%   11%       11%           6%         17%
## 6        5%     10%      2%        3%    4%        6%           3%          6%
##   Sexual.Orientation          X.5
## 1           Straight Gay/Bisexual
## 2                                
## 3                40%          21%
## 4                47%          49%
## 5                10%          19%
## 6                 3%          10%

Data Transformation

Based on the initial preview of the data, I felt that the survey questions, options, and responses were really hard to decipher based on how the Data Frame was already presented. In order to make the entire Data Frame more interpretative, I wanted to create a data structure that allows me to easily map the various questions asked in the survey to the options and corresponding responses to those options for each survey respondent. Since this data structure seems like a reference table, I figured the most suitable built-in data structure in R to use was the list. Therefore, I proceeded to create a list where the questions are the keys and the responses are the values. In order to make this transformation reusable, I created a R function called list_transform which allows me to pass in any Data Frame, a column to use as the key mapper, and the specific columns I want to leverage for mapping the values to the keys.

list_transform <- function(df, key_col, value_cols) { 
  
  # Ensure key_col and value_cols exist in the dataframe
  if (!(key_col %in% colnames(df))) {
    stop("Invalid key column name provided.")
  }
  if (!all(value_cols %in% colnames(df))) {
    stop("One or more value columns do not exist in the dataframe.")
  }
  
  # Identify rows where the key column is not empty or NA
  key_indices <- which(df[[key_col]] != "" & !is.na(df[[key_col]]))
  
  # Initialize named list
  result_list <- list()
  
  for (i in seq_along(key_indices)) { 
    start_idx <- key_indices[i] 
    end_idx <- ifelse(i < length(key_indices), key_indices[i + 1] - 1, nrow(df))
  
  
  
    # Extract relevant rows for the value columns
    
    subset_df <- df[start_idx:end_idx, value_cols, drop = FALSE]
  
    # Remove completely empty rows
    
    subset_df <- subset_df[rowSums(is.na(subset_df) | subset_df == "") < length(value_cols), , drop = FALSE]
  
    key <- df[[key_col]][start_idx]
  
    # Append values for the same key
    
    if (key %in% names(result_list)) { 
      result_list[[key]] <- bind_rows(result_list[[key]], subset_df) } 
    else { 
      result_list[[key]] <- subset_df 
      } 
    
    }
  
  return(result_list) 
}

I then renamed the first two columns to refer to the Questions and Options associated with each question before applying the list_transform function on the Questons column as the key and an array containing Options, Adult.Men, and Age as the value columns. I also validated whether the individual questions were showing up as keys by using the names() function. In order to avoid typing the question strictly as a string when trying to refer to a particular set of questions and options, I ended up leveraging an index on the key_names variable to easily have a numerical way of getting the exact string I needed when referencing the list. I also transformed this into a R function for re usability.

# Rename the first two columns

colnames(df)[1:2] <- c('Questions', 'Options')

# Apply the list_transform to the first two columns

ref_list <- list_transform(df, 'Questions', c('Options', 'Adult.Men', 'Age'))

print(ref_list)
## $`In general, how masculine or "manly" do you feel?`
##                Options Adult.Men Age
## 3       Very masculine       37% 29%
## 4   Somewhat masculine       46% 47%
## 5   Not very masculine       11% 13%
## 6 Not at all masculine        5% 10%
## 7            No answer        1%  0%
## 
## $`How important is it to you that others see you as masculine?`
##                 Options Adult.Men Age
## 9        Very important       16% 18%
## 10   Somewhat important       37% 38%
## 11    Not too important       28% 18%
## 12 Not at all important       18% 26%
## 13            No answer        0%  0%
## 
## $`Where have you gotten your ideas about what it means to be a good man? (Select all that apply.)`
##                       Options Adult.Men Age
## 15 Father or father figure(s)       64% 58%
## 16 Mother or mother figure(s)       41% 42%
## 17                    Friends       35% 42%
## 18       Other family members       35% 37%
## 19                Pop culture       23% 42%
## 20     Other (please specify)       17% 11%
## 
## $`Do you think that society puts pressure on men in a way that is unhealthy or bad for them?`
##      Options Adult.Men Age
## 22       Yes       60% 70%
## 23        No       39% 29%
## 24 No answer        1%  0%
## 
## $`Ask a friend for professional advice`
##                      Options Adult.Men Age
## 26                     Often       15% 26%
## 27                 Sometimes       42% 36%
## 28                    Rarely       23% 13%
## 29     Never, but open to it       12% 15%
## 30 Never, and not open to it        7%  9%
## 31                 No answer        1%  0%
## 
## $`Ask a friend for personal advice`
##                      Options Adult.Men Age
## 33                     Often       14% 22%
## 34                 Sometimes       41% 39%
## 35                    Rarely       27% 17%
## 36     Never, but open to it       10% 11%
## 37 Never, and not open to it        7%  9%
## 38                 No answer        1%  2%
## 
## $`Express physical affection to male friends, like hugging, rubbing shoulders`
##                      Options Adult.Men Age
## 40                     Often       14% 21%
## 41                 Sometimes       28% 25%
## 42                    Rarely       25% 19%
## 43     Never, but open to it       10% 14%
## 44 Never, and not open to it       22% 21%
## 45                 No answer        1%  0%
## 
## $Cry
##                      Options Adult.Men Age
## 47                     Often        7% 13%
## 48                 Sometimes       33% 35%
## 49                    Rarely       38% 30%
## 50     Never, but open to it       10%  8%
## 51 Never, and not open to it        9% 14%
## 52                 No answer        4%  0%
## 
## $`Get in a physical fight with another person`
##                      Options Adult.Men Age
## 54                     Often        2%  5%
## 55                 Sometimes        5% 10%
## 56                    Rarely       23% 22%
## 57     Never, but open to it       19% 19%
## 58 Never, and not open to it       50% 43%
## 59                 No answer        1%  2%
## 
## $`Have sexual relations with women, including anything from kissing to sex`
##                      Options Adult.Men Age
## 61                     Often       37% 41%
## 62                 Sometimes       26% 11%
## 63                    Rarely       13% 14%
## 64     Never, but open to it       10% 19%
## 65 Never, and not open to it       11% 16%
## 66                 No answer        2%  0%
## 
## $`Have sexual relations with men, including anything from kissing to sex`
##                      Options Adult.Men Age
## 68                     Often        5% 10%
## 69                 Sometimes        4%  6%
## 70                    Rarely        3%  6%
## 71     Never, but open to it        6% 12%
## 72 Never, and not open to it       80% 65%
## 73                 No answer        1%  0%
## 
## $`Watch sports of any kind`
##                      Options Adult.Men Age
## 75                     Often       38% 29%
## 76                 Sometimes       25% 19%
## 77                    Rarely       18% 24%
## 78     Never, but open to it        5%  7%
## 79 Never, and not open to it       13% 20%
## 80                 No answer        1%  0%
## 
## $`Work out`
##                      Options Adult.Men Age
## 82                     Often       21% 30%
## 83                 Sometimes       32% 31%
## 84                    Rarely       28% 25%
## 85     Never, but open to it       10%  7%
## 86 Never, and not open to it        7%  7%
## 87                 No answer        2%  0%
## 
## $`See a therapist`
##                      Options Adult.Men Age
## 89                     Often        5%  9%
## 90                 Sometimes        9% 10%
## 91                    Rarely       15% 11%
## 92     Never, but open to it       37% 35%
## 93 Never, and not open to it       32% 36%
## 94                 No answer        2%  0%
## 
## $`Feel lonely or isolated`
##                       Options Adult.Men Age
## 96                      Often       17% 24%
## 97                  Sometimes       29% 32%
## 98                     Rarely       31% 26%
## 99      Never, but open to it        5%  3%
## 100 Never, and not open to it       15% 15%
## 101                 No answer        2%  0%
## 
## $`Which of the following do you worry about on a daily or near daily basis? (Select all that apply.)`
##                                                                     Options
## 103                                                             Your weight
## 104 Your finances, including your current or future income, assets, or debt
## 105                                                    Your physical health
## 106                                                           Your physique
## 107         Your ability to provide for your family, current or anticipated
## 108                                                      Your mental health
## 109                                     Sexual performance or amount of sex
## 110                                                   Your hair or hairline
## 111                                                  Your clothing or style
## 112                                            Appearance of your genitalia
## 113                                                             Your height
## 114                                                       None of the above
##     Adult.Men Age
## 103       54% 45%
## 104       53% 53%
## 105       49% 42%
## 106       33% 40%
## 107       32% 33%
## 108       32% 45%
## 109       23% 24%
## 110       19% 33%
## 111       18% 31%
## 112       13% 17%
## 113        6% 12%
## 114       13% 10%
## 
## $`Which of the following categories best describes your employment status?`
##                                Options Adult.Men Age
## 116        Employed, working full-time       48% 40%
## 117        Employed, working part-time       10% 14%
## 118              Not employed, student        6% 18%
## 119               Not employed-retired       19%  4%
## 120     Not employed, looking for work        9% 19%
## 121 Not employed, NOT looking for work        8%  5%
## 122                          No answer        0%  0%
## 
## $`AMONG EMPLOYED: In which of the following ways would you say it?s an advantage to be a man at your work right now? (Select all that apply).`
##                                                            Options Adult.Men
## 124                                   Men are taken more seriously       23%
## 125                                            Men make more money       18%
## 126                                           Men have more choice       16%
## 127 Men have more promotion/professional development opportunities       14%
## 128            Men generally have more support from their managers       11%
## 129                          Men are explicitly praised more often        8%
## 130                                         Other (please specify)        7%
## 131                                              None of the above       59%
##     Age
## 124    
## 125    
## 126    
## 127    
## 128    
## 129    
## 130    
## 131    
## 
## $`AMONG EMPLOYED: In which of the following ways would you say it?s a disadvantage to be a man at your work right now? (Select all that apply.)`
##                                                     Options Adult.Men Age
## 133                 Managers want to hire and promote women       18%    
## 134      Greater risk of being accused of sexual harassment       42%    
## 135 Greater risk of being accused of being sexist or racist       38%    
## 136                                  Other (please specify)        5%    
## 137                                       None of the above       42%    
## 
## $`AMONG EMPLOYED: Have you seen or heard of a sexual harassment incident at your work? If so, how did you respond? (Select all that apply.)`
##                                         Options Adult.Men Age
## 139                 Contacted the HR department        8%    
## 140                      Did not respond at all        8%    
## 141  Reached out to the victim to offer support        7%    
## 142 Contacted the manager of the accused person        7%    
## 143               Confronted the accused person        5%    
## 144                      Other (please specify)        3%    
## 145           Never witnessed sexual harassment       75%    
## 
## $`AMONG THOSE WHO DID NOT RESPOND TO HARASSMENT: And which of the following is the main reason you did not respond?`
##                                       Options Adult.Men Age
## 147           You didn't want to get involved              
## 148 You weren't sure it was sexual harassment              
## 149        You didn't think it was your place              
## 150           You weren't sure who to contact              
## 151                    Other (please specify)              
## 152                                 No answer              
## 
## $`AMONG EMPLOYED: How much have you heard about the #MeToo movement?`
##            Options Adult.Men Age
## 154          A lot       42%    
## 155           Some       24%    
## 156  Only a little       11%    
## 157 Nothing at all       24%    
## 158      No answer        0%    
## 
## $`AMONG EMPLOYED WHO'VE HEARD OF METOO: As a man, would you say you think about your behavior at work differently in the wake of #MeToo?`
##       Options Adult.Men Age
## 160       Yes       34%    
## 161        No       65%    
## 162 No answer        1%    
## 
## $`Do you typically feel as though you're expected to make the first move in romantic relationships?`
##       Options Adult.Men Age
## 164       Yes       61% 62%
## 165        No       38% 38%
## 166 No answer        1%  1%
## 
## $`How often do you try to be the one who pays when on a date?`
##       Options Adult.Men Age
## 168    Always       49% 36%
## 169     Often       25% 22%
## 170 Sometimes       16% 24%
## 171    Rarely        2%  3%
## 172     Never        7% 12%
## 173 No answer        2%  2%
## 
## $`AMONG THOSE WHO TRY TO PAY ON FIRST DATE: Which of the following are reasons why you try to pay on dates? (Select all that apply).`
##                                                                              Options
## 175                                                       It's the right thing to do
## 176                           You asked the person out, so you feel obligated to pay
## 177                                       You feel good about being the one who pays
## 178 Societal expectations, even though you don?t always think you should have to pay
## 179                                               You make more money than your date
## 180        You try to pay to see if the other person will offer to share in the cost
## 181                                                           Other (please specify)
##     Adult.Men Age
## 175       66%    
## 176       49%    
## 177       39%    
## 178       27%    
## 179       11%    
## 180        7%    
## 181        7%    
## 
## $`When you want to be physically intimate with someone, how do you gauge their interest? (Select all that apply.)`
##                                                             Options Adult.Men
## 183                                    Every situation is different       59%
## 184 Read their physical body language to see if they are interested       46%
## 185           It isn?t always clear how to gauge someone?s interest       35%
## 186                        Ask for a verbal confirmation of consent       31%
## 187                      Make a physical move to see how they react       29%
## 188                                          Other (please specify)        7%
##     Age
## 183 54%
## 184 46%
## 185 37%
## 186 43%
## 187 34%
## 188  6%
## 
## $`Over the past 12 months, when it comes to sexual boundaries, which of the following things have you done? (Select all that apply.)`
##                                                                                              Options
## 190                        Wondered whether you pushed a partner too far in a past sexual encounter.
## 191                      Talked with a friend or friends about whether you pushed a partner too far.
## 192 Contacted a past sexual partner to ask whether you went too far in any of you sexual encounters.
## 193                                                                                None of the above
##     Adult.Men Age
## 190       10% 15%
## 191        5%  9%
## 192        3%  7%
## 193       85% 76%
## 
## $`Have you changed your behavior in romantic relationships in the wake of #MeToo movement?`
##       Options Adult.Men Age
## 195       Yes       13% 23%
## 196        No       86% 77%
## 197 No answer        1%  0%
## 
## $`Are you now married, widowed, divorced, separated, or have you never been married?`
##           Options Adult.Men Age
## 199       Married       46% 15%
## 200       Widowed        3%  0%
## 201      Divorced       13%  7%
## 202     Separated        2%  0%
## 203 Never married       36% 77%
## 204     No answer        0%  0%
## 
## $`Do you have any children? (Select all that apply.)`
##                                   Options Adult.Men Age
## 206    Yes, one or more children under 18       21% 21%
## 207 Yes, one or more children 18 or older       37%  6%
## 208                           No children       46% 74%
## 
## $`Would you describe your sexual orientation as:`
##       Options Adult.Men Age
## 210  Straight       84% 73%
## 211       Gay        8% 12%
## 212  Bisexual        3%  6%
## 213     Other        3%  5%
## 214 No answer        2%  4%
## 
## $`Are you:`
##      Options Adult.Men Age
## 216    White       67% 52%
## 217    Black       11% 19%
## 218 Hispanic       14% 16%
## 219    Asian        3%  6%
## 220    Other        5%  7%
## 
## $`What is the last grade of school you completed?`
##                          Options Adult.Men Age
## 222 Did not complete high school        4%  3%
## 223        High school or G.E.D.       36% 46%
## 224           Associate's degree        9%  5%
## 225                 Some college       21% 21%
## 226             College graduate       27% 25%
## 227         Post graduate degree        2%  1%
## 
## $age3
##       Options Adult.Men  Age
## 229   18 - 34       29% 100%
## 230   35 - 64       52%   0%
## 231 65 and up       19%   0%
# Key Names

key_names <- names(ref_list)

print(key_names)
##  [1] "In general, how masculine or \"manly\" do you feel?"                                                                                          
##  [2] "How important is it to you that others see you as masculine?"                                                                                 
##  [3] "Where have you gotten your ideas about what it means to be a good man? (Select all that apply.)"                                              
##  [4] "Do you think that society puts pressure on men in a way that is unhealthy or bad for them?"                                                   
##  [5] "Ask a friend for professional advice"                                                                                                         
##  [6] "Ask a friend for personal advice"                                                                                                             
##  [7] "Express physical affection to male friends, like hugging, rubbing shoulders"                                                                  
##  [8] "Cry"                                                                                                                                          
##  [9] "Get in a physical fight with another person"                                                                                                  
## [10] "Have sexual relations with women, including anything from kissing to sex"                                                                     
## [11] "Have sexual relations with men, including anything from kissing to sex"                                                                       
## [12] "Watch sports of any kind"                                                                                                                     
## [13] "Work out"                                                                                                                                     
## [14] "See a therapist"                                                                                                                              
## [15] "Feel lonely or isolated"                                                                                                                      
## [16] "Which of the following do you worry about on a daily or near daily basis? (Select all that apply.)"                                           
## [17] "Which of the following categories best describes your employment status?"                                                                     
## [18] "AMONG EMPLOYED: In which of the following ways would you say it?s an advantage to be a man at your work right now? (Select all that apply)."  
## [19] "AMONG EMPLOYED: In which of the following ways would you say it?s a disadvantage to be a man at your work right now? (Select all that apply.)"
## [20] "AMONG EMPLOYED: Have you seen or heard of a sexual harassment incident at your work? If so, how did you respond? (Select all that apply.)"    
## [21] "AMONG THOSE WHO DID NOT RESPOND TO HARASSMENT: And which of the following is the main reason you did not respond?"                            
## [22] "AMONG EMPLOYED: How much have you heard about the #MeToo movement?"                                                                           
## [23] "AMONG EMPLOYED WHO'VE HEARD OF METOO: As a man, would you say you think about your behavior at work differently in the wake of #MeToo?"       
## [24] "Do you typically feel as though you're expected to make the first move in romantic relationships?"                                            
## [25] "How often do you try to be the one who pays when on a date?"                                                                                  
## [26] "AMONG THOSE WHO TRY TO PAY ON FIRST DATE: Which of the following are reasons why you try to pay on dates? (Select all that apply)."           
## [27] "When you want to be physically intimate with someone, how do you gauge their interest? (Select all that apply.)"                              
## [28] "Over the past 12 months, when it comes to sexual boundaries, which of the following things have you done? (Select all that apply.)"           
## [29] "Have you changed your behavior in romantic relationships in the wake of #MeToo movement?"                                                     
## [30] "Are you now married, widowed, divorced, separated, or have you never been married?"                                                           
## [31] "Do you have any children? (Select all that apply.)"                                                                                           
## [32] "Would you describe your sexual orientation as:"                                                                                               
## [33] "Are you:"                                                                                                                                     
## [34] "What is the last grade of school you completed?"                                                                                              
## [35] "age3"
# Get the index of choice

col_to_idx <- key_names[34]

print(col_to_idx)
## [1] "What is the last grade of school you completed?"
# Function of above workflow
key_value_view <- function(key_names, idx, kv_map) {
  # Check if idx is valid
  if (idx >= length(key_names) || idx < 1) {
    stop("Index is out of range for key_names.")
  }
  
  # Get the exact key
  key_to_select <- key_names[idx]
  
  # Check if the key exists in kv_map
  if (!key_to_select %in% names(kv_map)) {
    stop("Key not found in kv_map.")
  }
  
  return(kv_map[[key_to_select]])  # Use double brackets for list extraction
}

Keyword Search for Referencing Question / Option Pairs

In order to flexibly get specific question / option pairs, I wanted to create a mechanism that allows me to type in a keyword of interest to find the respondent data associated with my question much faster rather than sifting through each question / options pair one-by-one. To achieve this, I needed to come up with a way to perform sub-string search within R and so I ended up using the grepl() function which can perform sub-string search and then I built a function in R that sifts through the key names and finds which key name or hits of key names contain the keyword that I was interested to find. I then ended up using this mechanism to search for physical health in order to get the answer to my original question.

keyword_search <- function(key_names, keyword) { 
  
  # Find indices where the substring is found 
  indices <- which(grepl(keyword, key_names, ignore.case=TRUE))

  # Return the indices (0 if no match) 
  if (length(indices) == 0) { 
    return(0) 
  } else { 
      return(c(key_names[indices], indices)) 
    } 
}

# Function Call

result <- key_value_view(key_names, 34, ref_list) 

print(result)
##                          Options Adult.Men Age
## 222 Did not complete high school        4%  3%
## 223        High school or G.E.D.       36% 46%
## 224           Associate's degree        9%  5%
## 225                 Some college       21% 21%
## 226             College graduate       27% 25%
## 227         Post graduate degree        2%  1%
# Key Names Associated with the Options

option_key_names <- df$Options

# Keyword Search

example_search <- keyword_search(option_key_names, 'physical health')

print(example_search)
## [1] "Your physical health" "105"
# Row in the DataFrame where the physical health option

df_row = df[example_search[2],]

print(df_row$Adult.Men)
## [1] "49%"

Findings and Recommendations

Findings

Based on the analysis above, I now know that 49% of the Adult Men respondents of the survey expressed concern or worry over their physical health. I wish there was more qualitative information to break down the reasons for concern or worry over physical health since the emphasis on the survey was not solely based on masculinity, but also based on its association post #MeToo movement and societal pressures. I hypothesize that there is increasing societal pressure for men to look and feel a certain way as physical health may have a lot to do with appearance, but then I also saw that appearance was a separate category which was further separated by various facets such as hairline and genitalia so clearly the physical health may have been too broad to make a proper assessment.

Recommendations

One recommendation I have for the survey creators is to consider breaking down physical health into components similar to some of the other categories / subcategories that exist within Concerns and Worries so it would be possible to better understand what is the specific aspect (s) of physical health that generates concern or worry for men and what that essentially means for their masculinity.