全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1956 2
2022-05-10
Issue the data(state) command to load the sample state data objects. We will work with the matrix
state.x77 which is one of the state sample data sets



a) Look up the help for state.x77.
b) Display the dimension names of the state.x77 matrix.
c) Write an expression that returns the summary statistics, as given by summary(), for each of the
columns in this matrix.
d) Create a vector named popdense that contains the population density in persons per square mile. Note
that the population in state.x77 is given in thousands.
e) Apply the pairs() function to the matrix to create scatter plots of all columns against one another.
f) When passed a matrix, the cor() function creates a correlation matrix where the value in the ith row
and the jth column is the correlation between the ith and jth columns of the original matrix. Use cor() to
create a correlation matrix named cor.state.x77.
g) The var() function is similar to the cor() function except that it creates a covariance matrix rather
than a correlation matrix. The diagonal elements are variances and the off diagonal elements are
covariances. Use the var() function to overwrite the elements on the diagonal of cor.state.x77
with variances and elements on the upper diagonal with covariances. Elements on the lower diagonal
will remain correlations.
h) Display the contents of the matrix sorted by descending Murder rates.
i) Select the states that have <1% illiteracy, but a murder rate of > 10 per 100, 000.
j) Select the states that have greater than average high school graduate rates, but less than average
annual income.


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2022-5-24 20:52:00
研究生R语言课程作业,内含该问题答案,代码是自己写的,欢迎大家一起交流~
附件列表

答案.pdf

大小:56.56 KB

只需: 5 个论坛币  马上下载

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2022-5-26 10:23:21
自己做出来了,挺好。
作业嘛,就要自己做才行。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群