Suppose you want to calculate how far each student was from the mean in exam 1 and store it in a column called deviation. Which of the following is a correct way to do so?单项选择题
A
grades$deviation <- mean(grades$exam1)
B
grades$exam1 <- mean(grades$exam1)
C
grades$exam1 <- mean(grades$exam1) - grades$exam1
D
grades$deviation <- grades$exam1 - mean(grades$exam1)
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
Suppose df has 50 rows with 3 numeric columns named x, y, and z. When you executed length(which(df$x >= 10)) the output returned is 10. Then, you executed df <- df %>% mutate(x = if_else(x >= 10, 10, -10)) What would be the result of the following line of code? length(which(df$x == -10))
Suppose you have given a subset of our North American Stock Market dataset in a data frame called compdf. There are all the 50 columns. Similar to our North American Stock Market dataset, gvkey and fyear combination uniquely identifies each observation in compdf. If you execute length(unique(compdf$loc)), you are returned 7. If you execute compdf %>% group_by(gvkey) %>% summarise(count = n()) , all the values under count column are 20. Suppose you executed the following code successfully. df1 <- compdf %>% group_by(loc, fyear) %>% summarise(stat1 = mean(at, na.rm = TRUE), stat2 = max(stat1)) df1 should have ____ rows and 4 columns.
Jeremy ran length(unique(csds$color)) and was returned 7. Later that day, Jeremy was informed that CSDS will have a promotion during the Holiday season. The management has decided to sell diamonds at discounted prices. The discount that would be applied will be based on color and expressed in discount data frame below. color_class percent 1 E 0.20 2 I 0.15 3 H 0.15 4 F 0.10 5 D 0.05 Jeremy wanted to create a summary table to report the average current price (i.e. average price without discount applied) and the average discounted price per color and clarity combination. Please complete the code below. csds_summary <- csds %>% ____A____ (____B____, by = c("____C____" = "____D____")) %>% mutate(discounted = ____E____ ( ____F____ (percent), price, (1-percent)*price)) %>% group_by(color, clarity) %>% summarise(average_current = mean(price), average_discounted = mean(discounted)) ____A____ [ Select ] left_join right_join ____B____ [ Select ] csds discount ____C____ [ Select ] color carat dimond_id color_class percent ____D____ [ Select ] color percent color_class discount ____E____ [ Select ] sum mean if_else na.omit ____F____ [ Select ] na.rm is.na n_distinct
Using air_df data frame below. airline origin destination daily_freq 1 QF SYD MEL 20 2 JQ SYD MEL 15 3 VA SYD MEL 17 4 QF SYD BNE 10 5 JQ SYD BNE 9 6 VA SYD BNE 6 7 QF MEL BNE 8 8 JQ MEL BNE 7 9 VA MEL BNE 11 10 QF MEL PER 7 11 VA MEL PER 5 You ran the following code in R: air_df_1 <- air_df %>% group_by(destination, origin) %>% summarise(total = sum(daily_freq)) If you execute air_df_1, what would you see on the Console? Note: You don't have to calculate the sum's. For a given destination and origin pair, the total is the same across all the options below.
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!