上一页 1 ··· 297 298 299 300 301 302 303 304 305 ··· 367 下一页
摘要: 1、 > a <- c(2,3,4,2,3,4,2,2,4) > b <- as.data.frame(table(a)) > b a Freq 1 2 4 2 3 2 3 4 3 阅读全文
posted @ 2021-04-17 12:24 小鲨鱼2018 阅读(1185) 评论(0) 推荐(0) 编辑
摘要: 1、 > a <- c(1,2,2,2,3,1,1,3) > a [1] 1 2 2 2 3 1 1 3 > unique(a) [1] 1 2 3 > duplicated(a) [1] FALSE FALSE TRUE TRUE FALSE TRUE TRUE TRUE > !duplicate 阅读全文
posted @ 2021-04-17 12:18 小鲨鱼2018 阅读(508) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 > a <- 1:5 > b <- 3:7 > a [1] 1 2 3 4 5 > b [1] 3 4 5 6 7 2、取交集 > a %in% b [1] FALSE FALSE TRUE TRUE TRUE > a[a %in% b] [1] 3 4 5 > intersect(a 阅读全文
posted @ 2021-04-17 12:11 小鲨鱼2018 阅读(573) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 > a <- c(3,2,2,2,2,2,9,1,4) > b <- c(7,8,4,4,4,6,5,2,3) > c <- c(3,5,7,4,3,2,1,8,6) > d <- data.frame(a, b, c) > d a b c 1 3 7 3 2 2 8 5 3 2 4 阅读全文
posted @ 2021-04-17 11:49 小鲨鱼2018 阅读(3053) 评论(0) 推荐(0) 编辑
摘要: 1、 opar <- par(no.readonly = T) par(fig=c(0,0.8,0,0.8)) plot(mtcars$wt,mtcars$mpg) par(fig=c(0,0.8,0.60,1),new= T) boxplot(mtcars$wt,axes = F,horizont 阅读全文
posted @ 2021-04-16 19:10 小鲨鱼2018 阅读(706) 评论(0) 推荐(0) 编辑
摘要: 1、 attach(mtcars) layout(matrix(c(1,1,2,3), 2, 2, byrow=T)) hist(wt) hist(mpg) hist(disp) detach(mtcars) 2、 attach(mtcars) layout(matrix(c(1,2,3,3),2, 阅读全文
posted @ 2021-04-16 18:11 小鲨鱼2018 阅读(1822) 评论(0) 推荐(0) 编辑
摘要: 1、 par(mfrow=c(3,2)) plot(1:10) text(1,5,"aa", cex = 2,col = "red") plot(1:10) text(5,5,"bb",cex = 2, col = "blue") plot(1:10) text(5,5, "cc", cex = 2 阅读全文
posted @ 2021-04-16 17:16 小鲨鱼2018 阅读(1564) 评论(0) 推荐(0) 编辑
摘要: 1、 > plot(1:10) > locator(1) ## 此时鼠标点击图形中位置,将返回位置坐标 $x [1] 2.202362 $y [1] 7.89666 > text(locator(1),"xxx",cex = 2,col="red") ## 结合text函数,可以图形中添加文本 > 阅读全文
posted @ 2021-04-16 16:49 小鲨鱼2018 阅读(2849) 评论(0) 推荐(0) 编辑
摘要: 1、 opar <- par(no.readonly = T) par(mfrow=c(2,2)) plot(1:10) legend("topleft",inset = 0.04,c(paste0("lab", 1:4)),pch = c(15:18), col = c("red","blue", 阅读全文
posted @ 2021-04-16 16:31 小鲨鱼2018 阅读(4806) 评论(0) 推荐(0) 编辑
摘要: 1、 plot(1:10) abline(h=5,col="red",lty=2,lwd = 3) 2、 plot(1:10) abline(h=c(2,4,6),col="red",lwd=3) 3、 plot(1:10) abline(v=c(2,4,8), col = "blue", lwd 阅读全文
posted @ 2021-04-16 15:43 小鲨鱼2018 阅读(1701) 评论(0) 推荐(0) 编辑
上一页 1 ··· 297 298 299 300 301 302 303 304 305 ··· 367 下一页