现在注册

登录

忘记密码

忘记密码? 请输入您的电子邮件地址. 您将收到一个链接,将创建通过电子邮件新密码.

添加后

你必须登录后添加 .

添加问题

您必须登录才能提问.

登录

现在注册

欢迎Scholarsark.com! 您的注册将授予您访问使用该平台的更多功能. 你可以问问题, 做出贡献或提供答案, 查看其他用户以及更多的个人资料. 现在注册!

LinkedIn skill assessment answers and questions — R (编程语言)

[R has established itself as a leading programming language in the realm of data analysis and statistical computing, renowned for its powerful capabilities and extensive library of packages. 在这份综合指南中, we’re delighted to present a curated collection of 技能评估问题答案 对于 [R.

Whether you’re a data scientist looking to enhance your analytical skills or a beginner eager to delve into the world of data science, this resource is tailored to help you become proficient in [R 及其应用. Join us as we explore the core concepts of R programming, including data manipulation, 可视化, statistical modelling, 和更多, empowering you to unlock the full potential of this versatile language.

第一季度. How does a matrix differ from a data frame?

  • A matrix may contain numeric values only.
  • A matrix must not be singular.
  • A data frame may contain variables that have different modes.
  • A data frame may contain variables of different lengths.

Q2. What value does this statement return?

unclass(as.Date("1971-01-01"))

  • 1
  • 365
  • 4
  • 12

Q3. What do you use to take an object such as a data frame out of the workspace?

  • remove()
  • erase()
  • detach()
  • 删除()

第四季度. Review the following code. What is the result of line 3?

xvect<-c(1,2,3)
xvect[2] <- "2"
xvect
  • [1] 1 2 3
  • [1] “1” 2 “3”
  • [1] “1” “2” “3”
  • [1] 7 9

Q5. The variable height is a numeric vector in the code below. Which statement returns the value 35?

  • height(length(height))
  • height[length(height)]
  • height[length[height]]
  • height(5)

Q6. 在下图中, the data frame is named rates. 该声明 sd(rates[, 2]) 返回 39. As what does R regard Ellen’s product ratings?

图片

  • sample with replacement
  • 人口
  • trimmed sample
  • 样本 <– not sure

Q7. Which choice does R regard as an acceptable name for a variable?

  • Var_A!
  • \_VarA
  • .2Var_A
  • Var2_A

Q8. What is the principal difference between an array and a matrix?

  • A matrix has two dimensions, while an array can have three or more dimensions.
  • An array is a subtype of the data frame, while a matrix is a separate type entirely.
  • A matrix can have columns of different lengths, but an array’s columns must all be the same length.
  • A matrix may contain numeric values only, while an array can mix different types of values.

Q9. Which is not a property of lists and vectors?

  • 类型
  • 长度
  • attributes
  • 标量

辅酶Q10. 在下图中, the data frame on lines 1 通过 4 is named StDf. State and Capital are both factors. Which statement returns the results shown on lines 6 和 7?

图片

  • StDf[1:2,-3]
  • StDf[1:2,1]
  • StDf[1:2,]
  • StDf[1,2,]

Q11. Which function displays the first five rows of the data frame named pizza?

  • BOF(pizza, 5)
  • 第一(pizza, 5)
  • 最佳(pizza, 5)
  • 头(pizza, 5)

Q12. You accidentally display a large data frame on the R console, losing all the statements you entered during the current session. What is the best way to get the prior 25 statements back?

  • console(-25)
  • console(reverse=TRUE)
  • 历史()
  • 历史(max.show = 25)

Q13. d.pizza is a data frame. It’s a column named temperature contains only numbers. If you extract temperature using the [] accessors, its class defaults to numeric. How can you access temperature so that it retains the class of data.frame?

> class( d.pizza[ , "temperature" ] )
> "numeric"
  • class( d.pizza( , "temperature" ) )
  • class( d.pizza[ , "temperature" ] )
  • class( d.pizza$temperature )
  • class( d.pizza[ , "temperature", drop=F ] )

Q14. What does c contain?

a <- c(3,3,6.5,8)
b <- c(7,2,5.5,10)
c <- a < b
  • [1] NaN
  • [1] -4
  • [1] 4 -1 -1 2
  • [1] TRUE FALSE FALSE TRUE

Q15. Review the statements below. Does the use of the dim function change the class of y, and if so what is y’s new class?

> y <- 1:9
> dim(y) <- c(3,3)
  • 没有, y’s new class isarray”.
  • 是, y’s new class is “矩阵”.
  • 没有, y’s new class isvector”.
  • 是, y’s new class isinteger”.

Q16. 什么是 mydf$y in this code?

mydf <- data.frame(x=1:3, y=c("a","b","c"), stringAsFactors=FALSE)

  • 列表
  • string
  • factor
  • character vector

Q17. How does a vector differ from a list?

  • Vectors are used only for numeric data, while lists are useful for both numeric and string data.
  • Vectors and lists are the same thing and can be used interchangeably.
  • A vector contains items of a single data type, while a list can contain items of different data types.
  • Vectors are like arrays, while lists are like data frames.

Q18. What statement shows the objects on your workspace?

  • list.objects()
  • print.objects()
  • getws()
  • ls()

Q19. What function joins two or more column vectors to form a data frame?

  • rbind()
  • cbind()
  • bind()
  • coerce()

Q20. Review line 1 下面. What does the statement in line 2 返回?

1 mylist <- list(1,2,"C",4,5)
2 unlist(mylist)
  • [1] 1 2 4 5
  • “C”
  • [1] “1” “2” “C” “4” “5”
  • [1] 1 2 C 4 5

Q21. What is the value of y in this code?

x <- NA
y <- x/1
  • Inf
  • Null
  • NaN
  • NA

Q22. Two variable in the mydata data frame are named Var1 and Var2. How do you tell a bivariate function, such as cor.test, which two variables you want to analyze?

  • cor.test(Var1 ~ Var2)
  • cor.test(mydata$(Var1,Var2))
  • cor.test(mydata$Var1,mydata$Var2)
  • cor.test(Var1,Var2, mydata)

Q23. A data frame named d.pizza is part of the DescTools package. A statement is missing from the following R code and an error is therefore likely to occur. Which statement is missing?

library(DescTools)
deliver <- aggregate(count,by=list(area,driver), FUN=mean)
print(deliver)
  • attach(d.pizza)
  • summarize(deliver)
  • mean <- rbind(d.pizza,count)
  • deliver[!complete.cases(deliver),]

Q24. How to name rows and columns in DataFrames and Matrices F in R?

  • data frame: names() and rownames() 矩阵: 科名() and row.names()
  • data frame: names() and row.names() 矩阵: dimnames() (not sure)
  • data frame: 科名() and row.names() 矩阵: names() and rownames()
  • data frame: 科名() and rownames() 矩阵: names() and row.names()

Q25. Which set of two statements-followed by the cbind() function-results in a data frame named vbound?

  • ­
v1<-list(1,2,3)
v2<-list(c(4,5,6))
vbound<-cbind(v1,v2)
  • ­
v1<-c(1,2,3)
v2<-list(4,5,6))
vbound<-cbind(v1,v2)
  • ­
v1<-c(1,2,3)
v2<-c(4,5,6))
vbound<-cbind(v1,v2)
  • ­ none

Q26. ournames is a character vector. What values does the statement below return to Cpeople?

Cpeople <- ournames %in% grep("^C", ournames, value=TRUE)

  • records where the first character is a C
  • any record with a value containing a C
  • TRUE or FALSE, depending on whether any character in ournames is C
  • TRUE and FALSE values, depending on whether the first character in an ournames record is C

Q27. What is the value of names(v[4])?

v <- 1:3
names(v) <- c("a", "b", "c")
v[4] <- 4
  • “”
  • d
  • NULL
  • NA

Q28. Which of the following statements doesn’t yield the code output below. Review the following code. What is the result of line 3?

x <- c(1, 2, 3, 4)
Output: [1] 2 3 4
  • X[C(2, 3, 4)]
  • X[-1]
  • X[C(-1, 0, 0, 0)]
  • X[C(-1, 2, 3, 4)]

Q29. Given DFMerged <- 合并(DF1, DF2) and the image below, how many rows are in DFMerged?

图片

  • 6
  • 9
  • 3
  • 0

Q30. What does R return in response to the final statement?

x<-5:8
names(x)<-letters[5:8]
x
  • e f g h “5” “6” “7” “8”
  • 5 6 7 8
  • e f g h
  • e f g h 5 6 7 8

Q31. How do you return “十月” from x in this code?

x<-as.Date("2018-10-01")
  • attr()
  • 个月(X)
  • as.month(X)
  • 月(X)

Q32. How will R respond to the last line of this code?

fact<-factor(c("Rep","Dem","Dem","Rep"))
fact
[1] Rep Dem Dem Rep
Levels: Rep Dem
fact[2]<-"Ind"
  • >
  • [,2]工业
  • invalid factor level, NA generated
  • 工业

Q33. What does R return?

StartDate<- as.Date("2020/2/28")
StopDate<- as.Date("2020/3/1")
StopDate-StartDate
  • “1970-01-02”
  • time difference of one day
  • time difference of two days
  • error in x-y: nonnumeric argument to binary operator

Q34. What does the expression mtrx * mtrx 做 ?

> mtrx <- matrix( c(3,5,8,4), nrow= 2,ncol=2,byrow=TRUE)
> newmat <- mtrx * mtrx
  • it transpose mtrx
  • it premultiplies the current netwmat row by the newmat column.
  • it returns the results of a matrix multiplication
  • It squares each cell in mtrx
> newmat
     [,1] [,2]
[1,]    9   25
[2,]   64   16

# The `%*%` operator gives matrix multiplication
> mtrx %*% mtrx
     [,1] [,2]
[1,]   49   35
[2,]   56   56

Q35. Which function in R combines different values into a single object?

  • 连接()
  • concat()
  • 接触()
  • C()

Q36. Which file contains settings that R uses for all users of a given installation of R?

  • Rdefaults.site
  • Renviron.site
  • Rprofile.site
  • Rstatus.site

Q37. 如果 mdf is a data frame, which statement is true ?

  • ncol(mdf) equals 长度(mdf).
  • The number of rows must equals the number of columns.
  • The legnth of any column in mdf may differ from any other column in mdf
  • All columns must have the same data type.

Q38. A list can contain a list as an element. MyList has five columns, and the third column’s item is a list of three items. How do you put all seven values in MyList into a single vector?

  • vector(MyList, length = 7)
  • coerce(MyList, nrows = 1)
  • unlist(MyList)
  • coerce(MyList, nrows = 7)

Q39. Which strings could be returned by the function ls(path =^V”)?

  • ANOVAData, anovadata
  • VisitPCA, VarX
  • VisitPCA, varx
  • Xvar, Yvar

Q40. StDf is a data frame. Based on this knowledge, what does this statement return?

StDf[, -1]
  • all but the first row and first column of StDf
  • all but the final column of StDf
  • all but the first column of StDf
  • only the first column of StDf

Q41. Which statement enables you to interactively open a single file?

  • file.list()
  • file.select()
  • file.choose()
  • file.open()

Q42. How are these data types alike: 合乎逻辑的, integer, numeric, 和性格?

  • Each is a type of data frame.
  • Each is a type of atomic vector.
  • Each is a type of complex vector.
  • Each is a type of raw vector.

Q43. 什么是 MyMat[ ,3] subsetting operation return for this code?

MyMat = matrix(c(7, 9, 8, 6, 10, 12),nrow=2,ncol=3, byrow = TRUE)
  • :
[ ,3]
[1, ] 8
[2, ] 12
  • :
[1] 8 12
  • :
[1] 10 12
  • :
[ ,3]
[1, ] 10
[2, ] 12

Q44. What does the function power.anova.test 返回?

  • the probability of making a Type I error
  • the probability of not making a Type II error
  • the probability of making a Type II error
  • the probability of not making a Type I error

Q45. Review the statement below. What is the effect of covariate:factor on the analysis?

result <- lm(outcome ~ covariate + factor + covariate:factor, data = testcoef)
  • It forces the intercepts of the individual regressions to zero.
  • It calls for the effect of the covariate within each level of the factor.
  • It calls for the effect of each variable from covariate to factor in testcoef.
  • It forces the covariate to enter the equation before the factor levels.
# Example call to demonstrate.  `Species` is a Factor.  Petal.Length, Petal.Width are numeric.
# see `help(formula)` for more details on the formula specification.  `:` is "effect modification" or "interaction"

> summary(lm(Petal.Length ~ Petal.Width + Species + Petal.Width:Species, data = iris))
...
Petal.Width:Speciesversicolor   1.3228     0.5552   2.382   0.0185 *
Petal.Width:Speciesvirginica    0.1008     0.5248   0.192   0.8480
...

Q46. A variable whose type is numeric can contain which items?

  • integers and real values
  • integers, 真实, and raw values
  • real values only
  • integers, 真实, and logical values

Q47. What is the legitimate name of a data class in R?

  • 财产
  • integer
  • variant

Q48. How do you extract the values above the main diagonal from a square matrix named Rmat?

  • Rmat[upper.tri(Rmat)]
  • upper.triangular(Rmat)
  • upper.tri(Rmat)
  • upper.diag(Rmat)

Q49. x is a vector of type integer, as shown on line 1 下面. What is the type of the result returned by the statement > 中位数(X)?

x <- c(12L, 6L, 10L, 8L, 15L, 14L, 19L, 18L, 23L, 59L)

  • numeric
  • integer
  • 单身的
  • 双倍的

辅酶50. A list named a is created using the statement below. Which choice returns TRUE?

a <- list("10", TRUE, 5.6)

  • is.list(一个[1])
  • is.numeric(一个[1])
  • is.logical(一个[1])
  • is.character(一个[1])

Q51. How do you obtain the row numbers in a data frame named pizza for which the value of pizza$delivery_min is greater than or equal to 30?

  • :
late_delivery <- pizza$delivery_min >= 30
index_late <- index(late_delivery)
index_late
  • :
late_delivery <- pizza$delivery_min >= 30
rownum_late <- rownum(late_delivery)
rownum_late
  • :
late_delivery <- pizza$delivery_min >= 30
which_late <- which(late_delivery)
which_late
  • :
late_delivery <- pizza$delivery_min >= 30
late <- piza$late_delivery
pizza$late

Q52. Which function returns [1] TRUE FALSE TRUE?

indat <- c("Ash Rd","Ash Cir","Ash St")

  • grepl(“[Rd|Ave|博士|圣]”, indat)
  • grepl(“Rd|Ave|博士|圣”, indat)
  • grepl(“Rd,Ave,博士,圣”, indat)
  • grepl(“[Rd],[Ave],[博士],[圣]”, indat)

Q53. Which statement returns the fourth row of a data frame named ?

  • 鱼[4, ]
  • 鱼( ,4)
  • 鱼(4, )
  • 鱼{4, }

Q54. What is the value of csum?

a <- c(1.2, 2, 3.5, 4)
b <- c(1.2, 2.2, 3.5, 4)
csum <-sum(a == b)
  • 8
  • 3
  • 0.2
  • 21.6

Q54. A list named 一个 is created using the statement below. Which choice returns TRUE?

a <- list("10", TRUE, 5.6)
  • is.list(一个[1])
  • is.numeric(一个[1])
  • is.logical(一个[1])
  • is.character(一个[1])

Q55. What is the result of these three lines of code?

vect1 <- c(1:4)
vect2 <- c(1:2)
vect1 * vect2
  • [1] 1 4 3 8
  • ERROR
  • [1] 1 2 3 4 1 2
  • [1] 1 2 3 4 2 4 6 8

Q56. Which choice returns [1] “2019-09-28”?

  • 格式(as.POSIXct(“Sep-28-2019 07:54:31 AM”,format=’%b%d%Y’))
  • as.POSIXlt(“Sep-28-2019 07:54:31 AM”,format=’%b-%d-%Y’)
  • as.POSIXct(“Sep-28-2019 07:54:31 AM UTC”)
  • 格式(as.POSIXct(“Sep-28-2019 07:54:31 AM UTC”,format=’%b-%d-%Y’))

Q57. The variable potus is a character vector, as shown in line 1 下面. Wich statement returns the results shown?

1 potus <- c("GHW Bush", "Clinton", "GW Bush", "Obama")

Results: [1] "GHW BUsh" "Clinton" "Obama"
  • potus[-“GW Bush”]
  • potus[1:2 4]
  • potus[-3]
  • potus[1,2,4]

Q58. A data frame contains two factor -fact1 and fact2- and a numerical outcome variable. Which statement returns results that do NOT include an interaction term?

  • anova(lm(outcome ~ fact1 : fact2))
  • anova(lm(outcome ~ fact1 * fact2))
  • anova(lm(outcome ~ fact1 + fact2))
  • anova(lm(outcome ~ fact1 + fact2 + fact1 : fact2))

Q59. Review line 1 下面. What does the statement on line 2 返回?

1 myvect <- c(-2,-1,0)
2 as.logical(myvect)
  • [1]-2 -1 0
  • [1]TRUE TRUE FALSE
  • [1]FALSE FALSE TRUE
  • [1]NA NA NA

Q60. Which option setting can cause difficulty if you want to add to a variable’s possible values after you have designed an object’s initial data structure?

  • ()OPTIONS(科名(X)<-NULL)
  • ()OPTIONS(max.print=5)
  • ()OPTIONS(continue=”… “,
  • ()OPTIONS(stringAsFactors=TRUE

Q61. In this image below, the data frame on lines 1 通过 4 is named StDf. StDf contains no factors. Why does statement on line 6 返回 “特点” while the statement on line 7 返回 “data.frame”?

图片

  • Each value in the first row is a character value, but the values in the third column include both character and numeric values.
  • By specifying the final row, 3, and no column specified, StDf[3, ] calls for the complete structure.
  • Columns in a data frame are vectors generally containing a single type of data. Rows in a data frame are lists, but they belong to a structure that has multiple rows: the data frame.
  • Each value in the first column is a character value, but the values in the third row include both character and numeric values.

Q62. Review line 1. What does the statement on line 3 返回?

mtrx <- matrix(1:6, 3, 2)

mtrx[, -1]

图片

  • ­

  • ­

  • ­

  • [1] 4 5 6

Q63. Why does sum(!is.na(pizza$week)) return the number of rows with valid, non-NA values in the column named week?

  • The exclamation point in !is.na(pizza$week) reverses the meaning of the test it precedes.
  • !is.na(pizza$week) counts the number of NA values in the column.
  • !is.na(pizza$week) returns a vector of TRUE/FALSE values, in which TRUE is treated as a 0 and FALSE as a 1.
  • !is.na(pizza$week) counts the number of non-missing values in the column.

Q64. How do you get documentation of an installed and loaded R package named dplyr and packages with dplyr as an alias?

  • 帮助(dplyr)
  • ? dplyr
  • ?? dplyr
  • Press the F1 key.

Q65. 在下图中, the data frame named iris includes a numeric vector named Petal.Length. Do the functions labeled Pair 1 and Pair 2 return the same information?

图片

  • 没有, both the length and the class of the returned structures are different.
  • 是, both pairs of statements return an object with the same length and class.
  • 没有, the length is the same but the class is different.
  • 没有, the class is the same but the length is different.

Q66. 该 _ for R are the main feature that make it different from the original S language.

  • closure rules
  • scoping rules
  • environment rules
  • 以上都不是

参考

Q67. Which of the following is a base package for R programming ?

  • 工具
  • util
  • lang
  • 上述所有的

参考

作者

  • 海伦·贝西

    你好, I'm Helena, 一位热衷于在教育领域发布有洞察力内容的博客作者. 我相信教育是个人和社会发展的关键, 我想与所有年龄和背景的学习者分享我的知识和经验. 在我的博客上, 您会找到有关学习策略等主题的文章, 在线教育, 职业指导, 和更多. 我也欢迎读者的反馈和建议, 所以请随时发表评论或联系我. 我希望您喜欢阅读我的博客并发现它有用且鼓舞人心.

    查看所有帖子

关于 海伦·贝西

你好, I'm Helena, 一位热衷于在教育领域发布有洞察力内容的博客作者. 我相信教育是个人和社会发展的关键, 我想与所有年龄和背景的学习者分享我的知识和经验. 在我的博客上, 您会找到有关学习策略等主题的文章, 在线教育, 职业指导, 和更多. 我也欢迎读者的反馈和建议, 所以请随时发表评论或联系我. 我希望您喜欢阅读我的博客并发现它有用且鼓舞人心.

发表评论