我是R的新手,正在尝试使用简单的plot()函数绘制图形。所以,我写了这段代码:
d=read.csv("Nutrition assay example")
head(d)
plot(d$Carbs0~d$EAAs0, typ="p", pch=19, ylab="Carbohydrate (g/bee)", xlab="Amino acids (g/bee)") ) lines(d$Carbs0~d$EAAs0)
lines(d$Carbs1~d$EAAs1, col="red")
points(d$Carbs1~d$EAAs1, col="red", pch=19)我得到了这样的信息:
Error in (function (formula, data = NULL, subset = NULL, na.action = na.fail, : invalid type (NULL) for variable 'd$Carbs1'有什么帮助和建议吗?
发布于 2017-11-04 09:25:49
您只需删除代码中多余的圆括号即可。
更改此(g/bee)") ) lines
添加到此代码(g/bee)") lines
完整代码
d=read.csv("Nutrition assay example")
head(d)
plot(d$Carbs0~d$EAAs0, typ="p", pch=19, ylab="Carbohydrate (g/bee)", xlab="Amino acids (g/bee)")
lines(d$Carbs0~d$EAAs0)
lines(d$Carbs1~d$EAAs1, col="red")
points(d$Carbs1~d$EAAs1, col="red", pch=19)https://stackoverflow.com/questions/47105471
复制相似问题