## Change line width to 120 characters to accomodate a dataset with ## lots of columns. options(width=120); ## Read the dataset popular.kids.data <- read.table("Dataset5.txt", header=TRUE); ## Make columns of data into variables attach(popular.kids.data) ## Create a data frame from just gender and goals gender.goals <- data.frame(Gender, Goals) ## Convert gender/goals data to a 2-way table gender.goals.tab <- table(gender.goals) ## Conduct a chi-square test chisq.test(gender.goals.tab)