[英]error generating qplot in R
I am still learning R. Tried looking up the reason for this error but not quite sure. 我仍在学习R。尝试查找此错误的原因,但不确定。
I am getting this error: 我收到此错误:
This is the .RMD code: 这是.RMD代码:
All I did was try to plot a simple graph, where sp is the dataset. 我所做的只是尝试绘制一个简单的图,其中sp是数据集。
The dataset lookis like this: 数据集看起来像这样:
xAxis|count|yAxis
18 |2 |0.1
20 |2 |0.1
22 |4 |0.3
25 |2 |0.2
30 |1 |0.1
39 |2 |0.1
UPDATE 更新
I tried saving the data like this: 我试过像这样保存数据:
SaveRDS(sp,file="C:\\Desktop\\sp1.RData")
I then wrote this code in R-Markdown: 然后,我在R-Markdown中编写了以下代码:
library(datasets)
load(file="C:\\Desktop\\sp1.RData")
plot(sp$xAxis,sp$yAxis)
And got this Error: 并得到此错误:
This is how I got it. 这就是我的方法。 Thanks to all of you for guiding me in the right direction. 感谢大家为我指引正确的方向。
I first saved the file like this: 我首先这样保存文件:
save(sp,file="C:\\Desktop\\sp.RData")
Then in R-Markdown, wrote something like this: 然后在R-Markdown中编写如下内容:
```{r load sp}
load("C:\\Desktop\\sp.RData")
plot(sp$xAxis,sp$yAxis)
```
Then pressed Knit to see the chart in the html popup window. 然后按编织以在html弹出窗口中查看图表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.