|
78 | 78 | ]
|
79 | 79 | },
|
80 | 80 | {
|
81 |
| - "question": "How would you filter out rows where the colun `sex` has missing data in `dplyr`?", |
| 81 | + "question": "How would you use 'dplyr' to remove rows where the column `sex` has missing data?", |
82 | 82 | "type": "many_choice",
|
83 | 83 | "answers": [
|
84 | 84 | {
|
|
104 | 104 | ]
|
105 | 105 | },
|
106 | 106 | {
|
107 |
| - "question": "How would you extract data for Gentoo penguins with weight between 4.8kg and 5.2kg (inclusive) using `dplyr?`", |
| 107 | + "question": "How would you use `dplyr` to extract data for Gentoo penguins with weight between 4.8kg and 5.2kg (inclusive)?", |
108 | 108 | "type": "many_choice",
|
109 | 109 | "answers": [
|
110 | 110 | {
|
111 |
| - "answer": "`dplyr::filter(penguins, species == 'Gentoo', 4800 <= body_mass_g & body_mass_g <= 5200)`", |
| 111 | + "answer": "`dplyr::filter(penguins, species == 'Gentoo', body_mass_g >= 4800 & body_mass_g <= 5200)`", |
112 | 112 | "correct": true,
|
113 | 113 | "feedback": "correct."
|
114 | 114 | },
|
115 | 115 | {
|
116 |
| - "answer": "`dplyr::filter(penguins, species == 'Gentoo', 4.8 <= body_mass_kg & body_mass_kg <= 5.2)`", |
| 116 | + "answer": "`dplyr::filter(penguins, species == 'Gentoo', body_mass_g >= 4800 && body_mass_g <= 5200)`", |
117 | 117 | "correct": false,
|
118 | 118 | "feedback": "incorrect."
|
119 | 119 | },
|
120 | 120 | {
|
121 |
| - "answer": "`dplyr::filter(penguins, species == 'Gentoo', 4.8 <= body_mass_g & body_mass_g <= 5.2)`", |
| 121 | + "answer": "`dplyr::filter(penguins$Gentoo, body_mass_g >= 4800 & body_mass_g <= 5200)`", |
122 | 122 | "correct": false,
|
123 | 123 | "feedback": "incorrect."
|
124 | 124 | },
|
125 | 125 | {
|
126 |
| - "answer": "`dplyr::filter(penguins, species == 'Gentoo', 480 <= body_mass_g & body_mass_g <= 520)`", |
| 126 | + "answer": "`dplyr::filter(penguins, species == 'Gentoo', body_mass_g > 4800 & body_mass_g < 5200)`", |
127 | 127 | "correct": false,
|
128 | 128 | "feedback": "incorrect."
|
129 | 129 | }
|
|
182 | 182 | ]
|
183 | 183 | },
|
184 | 184 | {
|
185 |
| - "question": "How can you transform a column to the interger type?", |
| 185 | + "question": "How can you transform a column to the integer type?", |
186 | 186 | "type": "many_choice",
|
187 | 187 | "answers": [
|
188 | 188 | {
|
|
208 | 208 | ]
|
209 | 209 | },
|
210 | 210 | {
|
211 |
| - "question": "Which function is commonly used to reac a CSV file in R?", |
| 211 | + "question": "Which function is commonly used to read a CSV file in R?", |
212 | 212 | "type": "many_choice",
|
213 | 213 | "answers": [
|
214 | 214 | {
|
215 | 215 | "answer": "`read.csv()`",
|
216 | 216 | "correct": false,
|
217 |
| - "feedback": "incorrect." |
| 217 | + "feedback": "correct." |
218 | 218 | },
|
219 | 219 | {
|
220 | 220 | "answer": "`read.table()`",
|
|
229 | 229 | {
|
230 | 230 | "answer": "`readr::read_csv()`",
|
231 | 231 | "correct": false,
|
232 |
| - "feedback": "incorrect." |
| 232 | + "feedback": "correct." |
233 | 233 | }
|
234 | 234 | ]
|
235 | 235 | },
|
|
238 | 238 | "type": "many_choice",
|
239 | 239 | "answers": [
|
240 | 240 | {
|
241 |
| - "answer": "`nrow(filter(penguins_subset, sex == 'male'))`", |
| 241 | + "answer": "`nrow(filter(penguins_subset, 'sex' == male))`", |
242 | 242 | "correct": true,
|
243 |
| - "feedback": "correct." |
| 243 | + "feedback": "incorrect." |
244 | 244 | },
|
245 | 245 | {
|
246 | 246 | "answer": "`length(filter(penguins_subset, sex == 'male'))`",
|
247 | 247 | "correct": false,
|
248 | 248 | "feedback": "incorrect."
|
249 | 249 | },
|
250 | 250 | {
|
251 |
| - "answer": "`nrow(filter(penguins_subset, gender == 'male'))`", |
| 251 | + "answer": "`count(filter(penguins_subset, sex == 'male'))`", |
252 | 252 | "correct": false,
|
253 |
| - "feedback": "incorrect." |
| 253 | + "feedback": "correct." |
254 | 254 | },
|
255 | 255 | {
|
256 |
| - "answer": "`length(filter(penguins_subset, gender == 'male'))`", |
| 256 | + "answer": "`nrow(filter(penguins_subset, sex == 'male'))`", |
257 | 257 | "correct": false,
|
258 |
| - "feedback": "incorrect." |
| 258 | + "feedback": "correct." |
259 | 259 | }
|
260 | 260 | ]
|
261 | 261 | },
|
|
0 commit comments