• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest May 19th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. ```{r}
2. library(aws.s3)
3. library('lehmansociology')
4. library(ggplot2)
5. library(dplyr)
6. library(lsr)
8. gss100<-droplevels(gss100)
9. ```
10.
11. #GRASS
12. #create a dichotomized variable where TRUE or 1 = supports legalization of grass and
13. #FALSE or 0 = does not support legalization of grass
14. ```{r}
15. frequency(gss100\$grass)
16. frequency(as.numeric(gss100\$grass))
17. gss100\$favorgrass<-as.numeric(gss100\$grass)==1
18. frequency(gss100\$favorgrass)
19. ```
20. #HEALTH
21. #create a dichotomized variable where TRUE or 1=excellent or good
22. #health and FALSE or 0=fair or poor health
23. ```{r}
24. frequency(gss100\$health)
25. frequency(as.numeric(gss100\$health))
26. gss100\$goodhealth<-as.numeric(gss100\$health)<3
27. frequency(gss100\$goodhealth)
28. ```
29. ```{r}
30. mean(gss100\$goodhealth, na.rm = TRUE)
31. ciMean(as.numeric(gss100\$goodhealth), na.rm=TRUE, conf =0.95)
32. ciMean(as.numeric(gss100\$goodhealth), na.rm=TRUE, conf =0.99)
33. ```
34. ```{r}
35. mean(gss100\$favorgrass, na.rm = TRUE)
36. ciMean(as.numeric(gss100\$favorgrass), na.rm=TRUE, conf =0.95)
37. ciMean(as.numeric(gss100\$favorgrass), na.rm=TRUE, conf =0.99)
38. ```
39. #HEALTH INDEPENDENT, GRASS DEPENDENT
40. #REMEMBER TO USE YOUR DICHOTOMIZED VARIABLES
41. #SO THIS WILL BE GOODHEALTH INDEPENDENT, FAVORGRASS DEPENDENT
42. ```{r}
43. goodhealth<-dplyr::filter(gss100, goodhealth=="TRUE")
44. ciMean(as.numeric(goodhealth\$favorgrass), na.rm=TRUE, conf =0.95)
45. ciMean(as.numeric(goodhealth\$favorgrass), na.rm=TRUE, conf =0.99)
49. ```
50.
51. #GRASS INDEPENDENT, HEALTH DEPENDENT
52. #REMEMBER TO USE YOUR DICHOTOMIZED VARIABLES
53. #SO THIS WILL BE FAVORGRASS INDEPENDENT, GOODHEALTH DEPENDENT
54. ```{r}
55. yesgrass<-dplyr::filter(gss100, favorgrass=="TRUE")
56. ciMean(as.numeric(yesgrass\$goodhealth), na.rm=TRUE, conf =0.95)
57. ciMean(as.numeric(yesgrass\$goodhealth), na.rm=TRUE, conf =0.99)
58. nograss<-dplyr::filter(gss100, favorgrass=="FALSE")
59. ciMean(as.numeric(nograss\$goodhealth), na.rm=TRUE, conf =0.95)
60. ciMean(as.numeric(nograss\$goodhealth), na.rm=TRUE, conf =0.99)
61. ```
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top