【发布时间】:2021-03-28 08:17:43
【问题描述】:
尝试在 R 中绘制一些数据 - 我是一个基本用户并自学。但是,每当我尝试绘图时,它都会失败,我不知道为什么。
> View(Pokemon_BST)
> Pokemon_BST <- read.csv("~/Documents/Pokemon/Pokemon_BST.csv")
> View(Pokemon_BST)
> plot("Type_ID", "Gender_ID")
Error in plot.window(...) : need finite 'xlim' values
In addition: Warning messages:
1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
2: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf
5: In min(x) : no non-missing arguments to min; returning Inf
6: In max(x) : no non-missing arguments to max; returning -Inf
这是我的代码,但我认为这可能是我的 .csv 文件的问题?我已将数字归因于“Type_ID”和“Gender_ID”列。 Type_ID 的值介于 1-20 之间; Gender_ID 男性为 1,女性为 2,两者均为 3。我应该声明这两个 ID 列都是由数值组成的。仅此而已。
然后我尝试使用 barplot 函数。发生此错误:
> barplot("Gender_ID", "Type_ID")
Error in width/2 : non-numeric argument to binary operator
In addition: Warning message:
In mean.default(width) : argument is not numeric or logical: returning NA
没有缺失值,这些列中没有字符,根据我的基本知识,没有任何内容应该导致错误。我只是不确定出了什么问题。
【问题讨论】: