上一页 1 ··· 171 172 173 174 175 176 177 178 179 ··· 367 下一页
摘要: 001、next(相当于continue, 跳过次轮循环) for (i in 1:5) { if (i %% 2 == 0) {next} ## 当i为偶数时,跳过次轮循环 cat(i,"test\n") } 002、break,终止当前程序 for (i in 1:5) { if (i %% 2 阅读全文
posted @ 2022-07-08 15:13 小鲨鱼2018 阅读(2337) 评论(0) 推荐(0) 编辑
摘要: 001、 a <- c(3, 4, 8, 7, 2) b <- c(2, 4, 5, 8, 9) c <- 1:5 dat <- data.frame(a, b, c) ## 测试数据框 dat dimnames(dat) ## 返回2元素列表, 1储存行名, 2存储列名 002、 a <- c(3 阅读全文
posted @ 2022-07-08 14:45 小鲨鱼2018 阅读(1526) 评论(0) 推荐(0) 编辑
摘要: 001、 a <- c(3, 4, 8, 7, 2) b <- c(2, 4, 5, 8, 9) c <- 1:5 dat <- data.frame(a, b, c) ## 生成测试数据框 dat d <- dat[1,2] ## 默认 class(d) e <- dat[1,2, drop = 阅读全文
posted @ 2022-07-08 09:30 小鲨鱼2018 阅读(620) 评论(0) 推荐(0) 编辑
摘要: 001、 均方根是一个数学概念,它是指在数据统计分析中,将所有值平方求和,求其均值,再开平方。 参考:https://zhuanlan.zhihu.com/p/140948897 阅读全文
posted @ 2022-07-08 09:03 小鲨鱼2018 阅读(808) 评论(0) 推荐(0) 编辑
摘要: 001、 regexpr("x", "edxerr") ## 返回匹配字符串的索引 regexpr("x", "edxerxr") ## 仅匹配第一个匹配到的字符串 002、 gregexpr("x", "edxerr") ## 返回匹配字符串的索引 gregexpr("x", "edxerxr") 阅读全文
posted @ 2022-07-07 20:00 小鲨鱼2018 阅读(663) 评论(0) 推荐(0) 编辑
摘要: 001、 test <- "erijk" temp <- unlist(strsplit(test, split = "")) ## 把字符串拆分为字符 rev(temp) paste(rev(temp), collapse = "") ## 逆转并合并 002、 test <- "akujm" # 阅读全文
posted @ 2022-07-07 19:17 小鲨鱼2018 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 001、 [root@PC1 test2]# echo "dsfedw" ## 测试字符串 dsfedw [root@PC1 test2]# echo "dsfedw" | awk 'BEGIN{FS = ""}{for(i = NF; i >= 1; i--) {printf("%s", $i)} 阅读全文
posted @ 2022-07-07 18:49 小鲨鱼2018 阅读(455) 评论(0) 推荐(0) 编辑
摘要: 001、R语言中utf8ToInt函数用于将UTF8值转换为整数值 utf8ToInt("a") ## 函数的参数为字符串 utf8ToInt("b") utf8ToInt("d") utf8ToInt("abcd") 002、逆向转换 intToUtf8(97) ## 数值转换为字符 intToU 阅读全文
posted @ 2022-07-07 18:34 小鲨鱼2018 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 001、 start <- Sys.time() ## 记录时间 Sys.sleep(70) ## 程序运行 end <- Sys.time() ## 记录时间 difftime(end, start, units = "sec") ## 以秒表示 difftime(end, start, unit 阅读全文
posted @ 2022-07-07 18:23 小鲨鱼2018 阅读(629) 评论(0) 推荐(0) 编辑
摘要: 001、 test <- "jEnMqAb" ## 测试字符串 newstr <- "" for (i in 1:nchar(test)) { if (i == 1){ newstr <- paste0(newstr, toupper(substr(test, 1, 1))) } else { ne 阅读全文
posted @ 2022-07-07 12:46 小鲨鱼2018 阅读(38) 评论(0) 推荐(0) 编辑
上一页 1 ··· 171 172 173 174 175 176 177 178 179 ··· 367 下一页