-
Notifications
You must be signed in to change notification settings - Fork 7
/
CastleOfR_Objects.txt
30 lines (30 loc) · 7.12 KB
/
CastleOfR_Objects.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name room objName location type points question solution val hint tip floorMapsIdx prepare cleanup
o_intro_1 intro pen on the floor power 3 Ask for help on the hint() function using the ? operator. `?`(hint) NA "?""?""" NA 0 NA NA
o_intro_2 intro box on a chair pwd 0 "How do you create the vector [1, 2, 3]?" "c(1, 2, 3)" "c(1, 2, 3)" c NA 0 NA NA
o_simple_3 simple bottle on a bed tip 0 Assign 7 to the a variable named x. x <- 7 NA Arrow "If you want to know how long before Lady R will get here, try ?timeLeft." 0 NA NA
o_simple_4 simple book on a stand power 3 A vector named x has been defined in your workspace. How do you get the square root of all elements in x? sqrt(x) NA 7 chars answer. NA 0 "x <<- c(4, 9, 16)" "tryCatch(rm(x, envir = globalenv()), warning = function(w) {invisible()})"
o_objectsRoom_5 objectsRoom tissue on the floor power 3 Find out the length of a variable named z. length(z) NA The answer is in the question. NA 0 z <<- 1:999 "tryCatch(rm(z, envir = globalenv()), warning = function(w) {invisible()})"
o_objectsRoom_6 objectsRoom picture on the wall map 0 The vector digits contains the digits 1 to 9 as characters. Convert them to numeric. as.numeric(digits) NA ?as.numeric NA 1 digits <<- as.character(1:9) "tryCatch(rm(digits, envir = globalenv()), warning = function(w) {invisible()})"
o_objectsRoom_7 objectsRoom can in an open box tip 0 Find out if the variable p contains a string is.character(p) NA p "If you lock a door after you have opened it, it will take Lady R longer to get you. Try ?lockDoor." 0 "p <<- ""is.character(p)""" "tryCatch(rm(p, envir = globalenv()), warning = function(w) {invisible()})"
o_factors_8 factors coin in a dustbin pwd 0 What is the mean of vector v? mean(v) NA The answer is in the question. NA 0 v <<- runif(10) "tryCatch(rm(v, envir = globalenv()), warning = function(w) {invisible()})"
o_factors_9 factors brush on a shelf power 3 fac is a factor vector. What are its levels? levels(fac) NA The answer is in the question. NA 0 "fac <<- gl(3, 4, labels = c(""dont"", ""go"", ""west""))" "tryCatch(rm(fac, envir = globalenv()), warning = function(w) {invisible()})"
o_arrays_10 arrays credit card attached to one of the doors power 3 How would you bind the 3D vectors x and y into a matrix of dimensions 3 x 2? "cbind(x, y)" NA ?cbind NA 0 "x <<- c(4, 9, 16); y <<- c(3, -1, 8)" "tryCatch(rm(x, y, envir = globalenv()), warning = function(w) {invisible()})"
o_arrays_11 arrays umbrella hung on the wall tip 0 Define an array of size 3 x 5 containing all zeros. Assign it to variable a. "a <- array(0, c(3, 5))" NA ?array If you forgot the question try ?whatWasTheQuestion. 0 NA "tryCatch(rm(fac, envir = globalenv()), warning = function(w) {invisible()})"
o_lists_12 lists lighter on the floor power 0 Append the value 3 to the beginning of list w. "w <- c(3, w)" NA c NA 0 "w <<- list(4, ""get the button"", 6)" "tryCatch(rm(w, envir = globalenv()), warning = function(w) {invisible()})"
o_lists_13 lists button on a chair pwd 3 Get all rows of the faithful dataset in which the eruptions time was over 5 minutes. Do not use the subset function. "faithful[faithful$eruptions > 5, ]" NA ?faithful NA 0 NA NA
o_reading_14 reading lipstick in a dustbin tip 0 "path_to_example1_file contains the path to the example1 text file in your system. Read it as a data frame, name it example1.df. It has a header." "example1.df <- read.table(path_to_example1_file, header = TRUE)" NA ?read.table Know your resources. Try ?whatDoIHave. 0 "path_to_example1_file <<- system.file(""extdata"", ""example1.txt"", package = ""CastleOfR"")" "tryCatch(rm(path_to_example1_file, example1.df, envir = globalenv()), warning = function(w) {invisible()})"
o_reading_15 reading jar on a shelf power 3 path_to_example3_file contains the path to the example3 RData file in your system. Load it. load(path_to_example3_file) NA The answer is in the question. NA 0 "path_to_example3_file <<- system.file(""extdata"", ""example3.RData"", package = ""CastleOfR"")" "tryCatch(rm(path_to_example3_file, example1.df, envir = globalenv()), warning = function(w) {invisible()})"
o_probability_16 probability banknote attached to one of the doors power 3 "Get the 0.95 percentile of the standard normal distribution (mean = 0, sd = 1)" qnorm(0.95) NA ?qnorm NA 0 NA NA
o_probability_17 probability comb on a stand pwd 0 "Get a random sample of size 10 from the U(0, 10) distribution." "runif(10, 0, 10)" NA ?runif NA 0 NA NA
o_grouping_18 grouping hat on a chair pwd 0 "x is a numeric vector. Create a new numeric vector y containing x elements if they are larger than 3, else replace them with 3." "y <- ifelse(x > 3, x, 3)" NA ?ifelse NA 0 "x <<- runif(10, -5, 10)" "tryCatch(rm(x, y, envir = globalenv()), warning = function(w) {invisible()})"
o_grouping_19 grouping a hand mirror in the corner power 3 "A while loop in which the condition is the word ""TRUE"" must be an endless loop. TRUE or FALSE?" FALSE NA Take a break. NA 0 NA NA
o_functions_20 functions toothbrush on a bed power 3 "The following function definition contains an error: f <- function(a = 1, b = a^2) cat(a, ""\n"", b) TRUE or FALSE?" FALSE NA Try it! NA 0 NA "tryCatch(rm(f, envir = globalenv()), warning = function(w) {invisible()})"
o_functions_21 functions battery in a cupboard pwd 0 "Write a function named sayHi which receives an argument named yourName and prints ""Hi, yourName"" to the screen (use the print and paste functions). If the yourName argument is missing, the function should print ""Hi, Lady R""." "sayHi <- function(yourName = ""Lady R"") print(paste(""Hi,"", yourName))" NA "One liner, curly brackets." NA 0 NA "tryCatch(rm(sayHi, envir = globalenv()), warning = function(w) {invisible()})"
o_models_22 models lightbulb lying on the floor power 3 x and y are two numeric vectors defined in your workspace. Fit a linear regression model of y over x. lm(y ~ x) NA ?lm NA 0 "x <<- rnorm(20, 3, 4); y <<- 2 * x + 1 + rnorm(20)" "tryCatch(rm(x, y, envir = globalenv()), warning = function(w) {invisible()})"
o_models_23 models postcard on the wall map 0 What is the Pearson Correlation Coefficient between x and y? "cor(x, y)" NA ?cor NA 4 "x <<- rnorm(20, 3, 4); y <<- 2 * x + 1 + rnorm(20)" "tryCatch(rm(x, y, envir = globalenv()), warning = function(w) {invisible()})"
o_plots_24 plots magazine on a stand tip 0 "Plot the faithful dataset. Use the ""f"" letters as points. Add a main title ""Old Faithful geyser""." "plot(faithful, pch = ""f"", main = ""Old Faithful geyser"")" NA ?pch If you want to see your password situation try ?seePassword 0 NA NA
o_plots_25 plots fork in a dustbin power 3 "Add the line y = 3*x - 1 to this plot. Make it a dashed line (line type 2), with width 3 and color blue. Do not use the word ""blue""." "abline(-1, 3, lty = 2, lwd = 3, col = 4)" NA ?abline NA 0 "plot(x = rnorm(5, 2), y = 5 * x + rnorm(3, 0, 5))" NA
o_packagesTower_26 packagesTower handkerchief attached to the window sill power 3 what is 0 + 0? 0 + 0 0 zero… NA 0 NA NA
o_packagesTower_27 packagesTower earing on the floor pwd 0 what is 0 + 0? 0 + 0 0 zero… NA 0 NA NA
o_osTower_28 osTower watch in the corner power 3 what is 0 + 0? 0 + 0 0 zero… NA 0 NA NA
o_osTower_29 osTower marble on a stand tip 0 what is 0 + 0? 0 + 0 0 zero… summonDragon(). Now. 0 NA NA