摘要: curl函数用于绘制函数的曲线。 1、 curve(x+0, -10, 10, bty="l") 2、 curve(2*x + 3, -10, 10, bty="l") 3、 curve(x^2,-5,5,bty="l") 4、 curve(x^2+3*x+1,-10,5) 5、 curve(2^x 阅读全文
posted @ 2022-05-07 22:22 小鲨鱼2018 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 1、asp参数用于定义绘图区域纵轴与横轴的比例 par(mfrow = c(2, 2)) plot(1:10, cex = 3, pch = 16, main = "asp = 1", cex.main = 3, asp = 1) plot(1:10, cex = 3, pch = 16, main 阅读全文
posted @ 2022-05-07 19:34 小鲨鱼2018 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 一、grep函数 1、提取特定开头项 > dat <- c(34, 22, 43, 64, 52, 347, 54) ## 测试向量 > dat [1] 34 22 43 64 52 347 54 > grep("^3", dat) ## 从dat中检索,提取以3开头的项,返回的是索引 [1] 1 阅读全文
posted @ 2022-05-07 18:16 小鲨鱼2018 阅读(619) 评论(0) 推荐(0) 编辑
摘要: 1、 library(ggplot2) Beijing <- c(116,40) ## 经纬度信息 Tokyo <- c(139, 36) Paris <- c(2, 48) Sydney <- c(150, -33) Newyork <- c(-74, 40) dat <- as.data.fra 阅读全文
posted @ 2022-05-07 14:09 小鲨鱼2018 阅读(526) 评论(0) 推荐(0) 编辑
摘要: 1、subset实现 > a <- 1:4 > b <- 5:8 > c <- letters[1:4] > d <- LETTERS[1:4] > dat <- data.frame(a, b, c, d) > dat ## 测试数据框,共四列 a b c d 1 1 5 a A 2 2 6 b 阅读全文
posted @ 2022-05-07 09:48 小鲨鱼2018 阅读(5288) 评论(0) 推荐(0) 编辑