Please change 林木木 to your name, and 411073221 to your school id.

Part I: Programming Question (Full mark is 30)

One big question with 5 small questions. Each is worth 6 points.

Before you start

Each question is framed like:

Create an object named practice and bind a numeric value of 5 to it.

# practice

The Question

1 Econ Survey

An online survey is distributed to students of Economics department.

1.1 Storing questions

There are two questions:

Suppose the following retrieval will print each question respectively:

survey$questions[[1]] # will show as
"Are you happy with our campus? Choose a number from 5(very happy), 4(happy), 3(satisfy), 2( unhappy), to 1(very unhappy)."
survey$options[[1]] # will show as
c(1, 2, 3, 4, 5)

survey$questions[[2]] # will show as
"Did you participate in any of the following activities? Check all that apply to you. (student association, school club, school sport team, department sport team)"
survey$options[[2]] # will show as
c("student association", "school club", "school sport team", "department sport team")

Construct the survey object that can satisfy the above retrieval outcomes:

# declare then add method
survey <- list() # declare
survey$questions[[1]] <- "Are you happy with our campus? Choose a number from 5(very happy), 4(happy), 3(satisfy), 2( unhappy), to 1(very unhappy)." # then-add
survey$options[[1]] <- c(1, 2, 3, 4, 5)

survey$questions[[2]] <- "Did you participate in any of the following activities? Check all that apply to you. (student association, school club, school sport team, department sport team)"
survey$options[[2]] <- c("student association", "school club", "school sport team", "department sport team")

# survey


tpemartin/rmdgrader documentation built on Nov. 22, 2022, 6:39 p.m.