r语言lm函数找不到对象

Python020

r语言lm函数找不到对象,第1张

百度知道

r语言找不到对象geneexp

查看全部1个回答

百度网友0f1c54f9b

超过127用户采纳过TA的回答

关注

成为第12位粉丝

r语言找不到对象geneexp,原因和解决方法如下。cor.test(x, ...)

## Default S3 method:

cor.test(x, y,

alternative = c("two.sided", "less", "greater"),

method = c("pearson", "kendall", "spearman"),

exact = NULL, conf.level = 0.95, continuity = FALSE, ...)

## S3 method for class 'formula'

cor.test(formula, data, subset, na.action, ...)

根本没有

cor.test(first,second,data= weightBJ_data)

这种调用方式,所以不识别对象first,second

你可以用

attach(weightBJ_data)

cor.test(first,second)

#或者

cor.test(weightBJ_data$first,weightBJ_data$second)

#或者

cor.test(weightBJ_data[,1],weightBJ_data[,2])

你用过attach(weightBJ_data)之后

first才能识别,但应该是没有逗号的。

first[2]

查看安装包是否正确。小伙伴们都喜欢读txt 和csv格式的,将xlsx格式另存为csv格式就可以读进去。但偶尔会有格式不兼容的情况,这个时候要先查看安装包是否正确。安装xlsx包时会提醒需要rJava包,而rJava包需要配置电脑的环境变量,没有环境变量会导致包装不上,全部设置完毕后在R中就可以正常加载rJava包。