r - 当我在 R 中运行我的代码时,它可以工作,但是如果我尝试将它编织成 pdf,它就会失败
问题描述
我一直在尝试获取下面的代码来编织。这是一个实验室,所以它的代码不多。
plot(cars$speed, cars$dist)
library(ggplot2)
ggplot(cars, aes(x=speed, y=dist)) + geom_point()
abline(lm(cars$speed ~ cars$dist), col ="red")
cor(cars$speed, cars$dist, use="complete.obs")
myVector = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
MyFunction <- function(x) {
y <- x*5
return(y)
}
MyFunction(myVector)
错误:
值 [[3L]] (cond) 中的错误:无效的图形状态调用:... TryCatch -> tryCatchList -> tryCatchOne ->
解决方案
通过在我得到它编织pdfabline()
之后直接放置plot()
library(ggplot2)
plot(cars$speed, cars$dist)
abline(lm(cars$speed ~ cars$dist), col ="red")
ggplot(cars, aes(x=speed, y=dist)) + geom_point()
cor(cars$speed, cars$dist, use="complete.obs")
myVector = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
MyFunction <- function(x) {
y <- x*5
return(y)
}
MyFunction(myVector)
推荐阅读
- python - pandas loc 然后 iloc 用于选择特定的列和行不起作用
- snowflake-cloud-data-platform - 是否可以使用数据共享来共享视图
- mysql - 将数据库上传到 GitHub
- php - php 注意:试图访问 null 类型值的数组偏移量
- javascript - 以希伯来语存储的 Cookie 在页面上显示为乱码
- javascript - 无法在屏幕 ReactJS 上显示 SVG 图像
- python - 在 C 结构中保存一个 numpy 数组
- java - 对象可以调用它被实例化的类中的方法吗?
- kubernetes - Kubernetes 单节点集群:部署新镜像后 dns 不工作
- arrays - 对嵌套属性的数组进行排序