当R运行这段代码时
piracy <- read.csv("piracy.csv")
gdp <- read.table("gdp.txt", sep=" ", header=TRUE)
countries <- merge(x = gdp, y = piracy)
plot(countries$GDP, countries$Piracy)
cor.test(countries$GDP, countries$Piracy)
line <- lm(countries$Piracy ~ countries$GDP)
abline(line)显示
countries <- merge(x = gdp, y = piracy)
Error in merge(x = gdp, y = piracy) : object 'gdp' not found
plot(countries$GDP, countries$Piracy)
Error in plot(countries$GDP, countries$Piracy) :
object 'countries' not found
cor.test(countries$GDP, countries$Piracy)
Error in cor.test(countries$GDP, countries$Piracy) :
object 'countries' not found
line <- lm(countries$Piracy ~ countries$GDP)
Error in eval(expr, envir, enclos) : object 'countries' not found
abline(line)
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
cannot coerce type 'closure' to vector of type 'double'
piracy <- read.csv("piracy.csv")
Error in read.table(file = file, header = header, sep = sep, quote = quote, :
有点不懂啊,请教老师
当R运行这段代码时 piracy <- read.csv("piracy.csv") gdp <- read.table("gdp.txt", sep=" ", header=TRUE) countries <- merge(x = gdp, y = piracy) plot(countries$GDP, countries$Piracy) cor.test(countries$GDP, countries$Piracy) line <- lm(countries$Piracy ~ countries$GDP) abline(line)显示