题目
题目

COMM_V 205 101 102 103 2025W1 R Review Quiz

判断题

Assume that you run the following code. just_above_ave = min(student$grade[which(student$grade >= mean(student$grade))]) Then, you decided to get the same result in an alternative way.  df5 <- student %>%    filter(grade >= mean(grade)) %>%    summarise(min(grade)) the value in df5[1,1] is equal to just_above_ave.

选项
A.True
B.False
查看解析

查看解析

标准答案
Please login to view
思路分析
Let's examine what each piece of code does step by step, and then compare the results. Option assessment start with the first approach: just_above_ave = min(student$grade[which(student$grade >= mean(student$grade))]). - This computes the mean of all grades: mean(student$grade). - It then selects all grades that are greater than or equal to that mean: student$grade[student$grade >= mean(student$grade)]. - It applies min(...) to these selected grades, giving the smallest grade that is still at least the mean. If there are any tie......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

类似问题

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 [Fill in the blank] rows and 4 columns. If the information provided in the question is not sufficient, please type "not enough information". 

Suppose you had a dataset (assigned to data frame object called df). You know that it has 100 observations with a single numerical column called a. All observations for a are equal to 100. You then run the following code: df$b <- df$a df$a <- 0 mean(df$a != df$b) What did R output when the entire code was executed successfully? [Fill in the blank]

Suppose df has 30 rows with 3 numeric columns named d, e, and f. When you executed length(which(df$d >= 5)) the output returned is 20. Then, you executed df <- df %>% mutate(d = if_else(d >= 5, 5, 0)) TRUE/FALSE: When you execute the following line of code, the result returned can be less than 10. length(which(df$d == 0))

Suppose you had a dataset (assigned to data frame object called df). df has 100 observations with a single numerical column called col1. col1 value of each observation is equal to 10. You then run the following code: df$col2 <- df$col1 df$col1 <- 0 mean(df$col2) What did R output when the entire code was executed successfully? [Fill in the blank]

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!