R语言明明导入数据了 却说找不到对象 赋值一列数据无力 望解答

Python019

R语言明明导入数据了 却说找不到对象 赋值一列数据无力 望解答,第1张

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

R语言的特点

R作为一种统计分析软件,是集统计分析与图形显示于一体的。它可以运行于UNIX、Windows和Macintosh的操作系统上,而且嵌入了一个非常方便实用的帮助系统,相比于其他统计分析软件,R还有以下特点:

R是自由软件。这意味着它是完全免费,开放源代码的。可以在它的网站及其镜像中下载任何有关的安装程序、源代码、程序包及其源代码、文档资料。标准的安装文件身自身就带有许多模块和内嵌统计函数,安装好后可以直接实现许多常用的统计功能。

以上内容参考:百度百科-R语言

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]

希望对你有所帮助!