上一页 1 ··· 288 289 290 291 292 293 294 295 296 ··· 367 下一页
摘要: 1、显示所有的小于输入的整数的所有2的乘方 while语句: #include <stdio.h> int main(void) { int i = 2, j; puts("please input an integer."); printf("j = "); scanf("%d", &j); wh 阅读全文
posted @ 2021-04-28 09:44 小鲨鱼2018 阅读(220) 评论(0) 推荐(0) 编辑
摘要: mean 阅读全文
posted @ 2021-04-27 23:38 小鲨鱼2018 阅读(40) 评论(0) 推荐(0) 编辑
摘要: R语言中自编函数(例题) 1、 mystats <- function(x, parametric = TRUE, print = FALSE){ if (parametric) { center = mean(x); spread = sd(x) }else { center <- median( 阅读全文
posted @ 2021-04-27 17:04 小鲨鱼2018 阅读(924) 评论(0) 推荐(0) 编辑
摘要: R语言中自定义函数以函数的加载调用 1、自定义函数 test1 <- function(x,y){ a = (x + y) print(a) } test2 <- function(x, y){ a = x - y print(a) } test3 <- function(x, y){ a = x 阅读全文
posted @ 2021-04-27 16:34 小鲨鱼2018 阅读(3088) 评论(0) 推荐(0) 编辑
摘要: 1、测试break #include <stdio.h> int main(void) { int i, j; puts("please input an integer."); printf("j = "); scanf("%d", &j); for(i = 1; i <= j; i++) { i 阅读全文
posted @ 2021-04-27 14:59 小鲨鱼2018 阅读(645) 评论(0) 推荐(0) 编辑
摘要: 1、for语句 for (i in 1:5) { print("hello world!") } 2、for语句 sum = 0 for (i in 1:100){ sum = sum + i } print(sum) 3、for语句 sum = 0 for (i in 1:100) { if (i 阅读全文
posted @ 2021-04-27 12:29 小鲨鱼2018 阅读(693) 评论(0) 推荐(0) 编辑
摘要: R语言中aggregate函数进行数据整合 1、 name <- rep(c("a","b","c"),3) math <- 1:9 eng <- c(3,5,2,2,4,8,7,2,4) chi <- c(3,4,8,5,9,4,7,5,6) test <- data.frame(name, ma 阅读全文
posted @ 2021-04-27 12:11 小鲨鱼2018 阅读(367) 评论(0) 推荐(0) 编辑
摘要: R语言中apply函数(实现对数据框或者矩阵行或者列的计算) 1、 a <- matrix(sample(1:10,12,replace = T), nrow = 4,ncol = 3) a b <- apply(a, 1, sum) ## 1表示按照行计算, 2表示按照列进行计算 b c <- a 阅读全文
posted @ 2021-04-27 11:30 小鲨鱼2018 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 1、subset函数(同时实现对行和列的提取) a <- 1:8 b <- letters[1:8] c <- LETTERS[1:8] d <- data.frame(a,b,c) d e <- subset(d,a > 4 & a < 8, select = c(a,b)) e f <- sub 阅读全文
posted @ 2021-04-27 11:21 小鲨鱼2018 阅读(545) 评论(0) 推荐(0) 编辑
摘要: 输出向下的金字塔 1、for语句 #include <stdio.h> int main(void) { int i, j, layer; puts("please input the layer"); printf("layer = "); scanf("%d", &layer); for(i = 阅读全文
posted @ 2021-04-27 10:56 小鲨鱼2018 阅读(250) 评论(0) 推荐(0) 编辑
上一页 1 ··· 288 289 290 291 292 293 294 295 296 ··· 367 下一页