随笔分类 -  R语言

上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 27 下一页
摘要:001、问题, 非root用户安装R遇到如下报错: checking whether zlib support suffices... configure: error: zlib library and headers are required 002、解决方法 切换为root, 安装curl: 阅读全文
posted @ 2023-01-13 22:55 小鲨鱼2018 阅读(405) 评论(0) 推荐(0)
摘要:001、问题 002、切回root,执行如下命令 [liujiaxin01@PC1 software]$ wget http://mirrors.ctan.org/fonts/inconsolata.zip --no-check-certificate [liujiaxin01@PC1 softwa 阅读全文
posted @ 2023-01-12 22:33 小鲨鱼2018 阅读(274) 评论(0) 推荐(0)
摘要:001、问题: configure: error: libcurl >= 7.28.0 library and headers are required with support for https 002、解决方法:切回root, 安装curl [root@PC1 software]# wget 阅读全文
posted @ 2023-01-12 22:22 小鲨鱼2018 阅读(1579) 评论(0) 推荐(0)
摘要:001、问题:configure: error: --with-x=yes (default) and X11 headers/libs are not available 002、解决方法 a、切换为root用户 [liujiaxin01@PC1 R-4.2.1]$ su - root Passw 阅读全文
posted @ 2023-01-12 22:05 小鲨鱼2018 阅读(2067) 评论(0) 推荐(0)
摘要:001、问题 configure: error: --with-readline=yes (default) and headers/libs are not available 002、解决方法 a、切换回root用户 [liujiaxin01@PC1 R-4.2.1]$ su - root Pa 阅读全文
posted @ 2023-01-12 21:55 小鲨鱼2018 阅读(1713) 评论(0) 推荐(0)
摘要:使用 padj参数调整垂直距离; 使用hadj参数调整水平距离; 001、padj参数 par(mfrow = c(2,1)) plot(1:10, cex = 2, pch = 17, xaxt ="n", xlab = "", main = "0.5") axis(1, at=seq(0, 10 阅读全文
posted @ 2023-01-07 21:30 小鲨鱼2018 阅读(723) 评论(0) 推荐(0)
摘要:001、 dev.off() ## 关闭上一步的绘图设备(如果有) opar <- par(no.readonly = TRUE) ## 保存默认设置 par(bg = "cyan") ## 利用par设置绘图参数 plot(1:10) ## 绘图 002、取消par函数对绘图的设置, 回复默认 p 阅读全文
posted @ 2022-09-11 16:51 小鲨鱼2018 阅读(2043) 评论(0) 推荐(0)
摘要:001、R语言中plot函数基础背景色为白色 plot(1:10) ## 测试基础绘图 002、 par(bg = "cyan", fg = "purple") ## 利用par函数指定绘图的背景色和前景色 plot(1:10) 阅读全文
posted @ 2022-09-11 16:33 小鲨鱼2018 阅读(1487) 评论(0) 推荐(0)
摘要:ggplot中 001、默认绘图背景颜色 library(ggplot2) ggplot(mtcars , aes(x=mpg, y=wt)) + geom_point() ## 测试默认绘图颜色 002、调整绘图的背景颜色 ggplot( mtcars , aes(x=mpg, y=wt)) + 阅读全文
posted @ 2022-09-11 16:25 小鲨鱼2018 阅读(1836) 评论(0) 推荐(0)
摘要:001、 mat <- matrix(1:16, 4, 4) ## 生成矩阵 mat ## 显示矩阵 002、提取矩阵的对角线 mat diag(mat) ## 提取矩阵的对角线 003、利用diag生成单位矩阵 diag(5) ## 生成单位矩阵 004、提取矩阵的上三角矩阵及下三角矩阵 mat 阅读全文
posted @ 2022-09-10 13:30 小鲨鱼2018 阅读(1589) 评论(0) 推荐(0)
摘要:001、测试基本绘图 data=iris ## 导入数据 library(ggplot2) ## 加载包 ggplot(data = data, aes(x=Petal.Length,y=Sepal.Length)) + ## 基本绘图程序 geom_point() 002、清除灰色背景、背景框线、 阅读全文
posted @ 2022-09-09 22:27 小鲨鱼2018 阅读(3243) 评论(0) 推荐(0)
摘要:001、判断是否以升序排列 dat <- 1:5 ## 测试数据 dat1 <- c(1, 5, 2, 3, 4) ## 测试数据 identical(dat, sort(dat)) ## 判断dat是否以升序排列 identical(dat2, sort(dat2)) ## 判断dat2是否以升序 阅读全文
posted @ 2022-09-09 22:05 小鲨鱼2018 阅读(297) 评论(0) 推荐(0)
摘要:该函数类似c语言中的printf函数。 001、 result = 100 print(result) ## print函数可以直接输出变量的结果 print("result is :%d", result) ## print不能输出字符串 + 变量的组合 sprintf("result is :% 阅读全文
posted @ 2022-09-09 17:33 小鲨鱼2018 阅读(2999) 评论(0) 推荐(0)
摘要:melt函数将“长数据”转换为“短数据”。 001、 指定单个ID library(reshape2) ID <- c(1,1,2,2) Time <- c(1,2,1,2) X1 <- c(5,3,6,2) X2 <- c(6,5,1,4) mydata <- data.frame(ID,Time 阅读全文
posted @ 2022-09-09 17:18 小鲨鱼2018 阅读(6382) 评论(0) 推荐(0)
摘要:001、 .Primitive 与.Internal的函数通常都是 C语言写成的,所以在R的开发环境中中是无法显示的。到网上下载R的源代码,然后在 src/main/*.c (通常位于这个位置)下查找。 参考:https://blog.csdn.net/weixin_36054993/article 阅读全文
posted @ 2022-09-08 17:52 小鲨鱼2018 阅读(93) 评论(0) 推荐(0)
摘要:001、 a <- 1:5 b <- 11:15 dat <- rbind(a, b) colnames(dat) <- paste0("c", 1:5) dat ## 测试数据框 dimnames(dat) ## 同时获取行名和列名,并生成列表 002、可以利用该函数给数据框或者矩阵命令行名和列名 阅读全文
posted @ 2022-09-08 16:25 小鲨鱼2018 阅读(896) 评论(0) 推荐(0)
摘要:missing函数作用就是如果y没有具体的值,那么输出为真,如果y有具体的值,那么输出为假,这么说可能有点抽象,举个例子: 001、 myplot <- function(x,y) { if(missing(y)) { y <- x x <- 1:length(y) } plot(x,y) } my 阅读全文
posted @ 2022-09-08 14:44 小鲨鱼2018 阅读(349) 评论(0) 推荐(0)
摘要:概述: 公式: 公式里的U就是下面运行结果的a$u,Σ就是下面的a$d变换成的对角矩阵(diag(a$d)),V就是下面运行结果的a$v 001、 > x <- matrix(1:20,nrow = 4,ncol = 5) ## 生成测试矩阵 > x [,1] [,2] [,3] [,4] [,5] 阅读全文
posted @ 2022-09-08 12:08 小鲨鱼2018 阅读(473) 评论(0) 推荐(0)
摘要:001、 seq_len(3) ## 用于生成指定长度的1到指定长度的序列 seq_len(9) seq_len(0) 阅读全文
posted @ 2022-09-08 11:53 小鲨鱼2018 阅读(323) 评论(0) 推荐(0)
摘要:相当于poyhton中assert函数, 用于嵌入函数中, 在检测某一确定的变量或条件是否为真, 如果判断为假,则为终止程序。 001、 stopifnot(3 > 0) 002、 stopifnot(3 < 0) 阅读全文
posted @ 2022-09-08 11:32 小鲨鱼2018 阅读(1252) 评论(0) 推荐(0)

上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 27 下一页