Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
"1 for "Strong Disagree"
"2" for "Disagree"
"3" for "Moderately Disagree"
"4" for "Neutral"
"5" for "Agree"
"6" for "Strongly Agree"
Data<-Data%>%
mutate(In1.1=recode(`In1`,
"1" = "Strongly Disagree", "2" ="Disagree", "3" = "Moderately Disagree", "4" = "Neutral", "5"="Agree", "6" = "Strongly Agree", "7" = "Moderately Agree"))%>%
mutate(In2.1=recode(`In2`,
"1" = "Strongly Disagree", "2" ="Disagree", "3" = "Moderately Disagree", "4" = "Neutral", "5"="Agree", "6" = "Strongly Agree", "7" = "Moderately Agree"))
Data$In1=as.numeric(Data$In1)
Data$In2=as.numeric(Data$In2)
Data$In3=as.numeric(Data$In3)
Data$In4=as.numeric(Data$In4)
Data$In5=as.numeric(Data$In5)
a. How many observations in Variable In1 that are strongly agree at the same time moderately disagree in variable In2?
Ian2<-Data%>%
group_by(In1.1, In2.1) %>%
summarise(count=n())
`summarise()` has grouped output by 'In1.1'. You can override using the
`.groups` argument.
paged_table(Ian2)
Answer: There are no variables from In1 that are strongly agree at the same time moderately disagree in In2.
b. How many observations in Variable In2 that are strongly agree at the same time Neutral in variable In1?
Ian3<-Data%>%
group_by(In1.1, In2.1) %>%
summarise(count=n())
`summarise()` has grouped output by 'In1.1'. You can override using the
`.groups` argument.
paged_table(Ian3)
Answer: There are 9 in variable In2 that are strongly agree at the same time Neutral in In1.
Data<-Data%>%
mutate(`Group 1` = ifelse(Age<=20,"Less than 20 years old",
ifelse(Age>=22, "NA", "NA")))%>%
mutate(`Group 2` = ifelse(Age<=22, "More than 22 years old", "NA"))