data-journalism / djclass2015

数据新闻课程2015
http://data-journalism.github.io/djclass2015/
7 stars 66 forks source link

运行出错 #89

Open liligede opened 9 years ago

liligede commented 9 years ago

当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, : 有点不懂啊,请教老师

chengjun commented 9 years ago

@liligede 这个问题已经被回复过,见这里 https://github.com/data-journalism/djclass2015/issues/70