Giter Club home page Giter Club logo

homework-6's Introduction

title author date output
Homework #6
Nick Preszler
3/9/2022
html_document

Import Packages and Data

library(tidyverse)
happy = readRDS("~/DS202/Homework-6/data/HAPPY.rds")

Clean Data

h1 = replace(happy, happy %in% c('IAP', 'DK', 'NA'), NA)
h1 = replace(happy, happy == 'IAP', NA)
h1 = replace(h1, h1 == 'DK', NA)
h1 = replace(h1, h1 == 'NA', NA)

#Change age to numeric
h1 = h1 %>% mutate(AGE = replace(AGE, AGE == "89 OR OLDER", 89)) %>%
  mutate(AGE = as.numeric(AGE, na.rm = TRUE))

Reorder Factors & Save RDS file

h1$DEGREE = factor(h1$DEGREE, levels=c('LT High School',
                                    'High School',
                                    'Junior College',
                                    'Bachelor',
                                    'Graduate'))
saveRDS(h1,'happiness')

Is there a relationship between happiness and sex of marital status? Visualisation of relationship between happiness and sex broken down by marital status.

h1 %>% ggplot(aes(x=SEX,fill=HAPPY)) + geom_bar() + facet_wrap(~MARITAL)

The above visualization seperates the happiness of individuals by their sex and marital status and plots the quanitiy of each happiness category in the sex-marital status pairs with differing colors. This visualization suggests that there is no large impact on the happiness of an individual on the basis of their sex or marital status. Married people, for example, have a very similar ratio of happiness categories as divorced people. Similarly, male and female married people have very similar distributions of happiness.

homework-6's People

Contributors

preszlern avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.