Skip to content

Commit

Permalink
Update 2024-11-6-R_study.md
Browse files Browse the repository at this point in the history
  • Loading branch information
azure2870 authored Nov 6, 2024
1 parent 1e6b308 commit 03b67f4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions _posts/2024-11-6-R_study.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,9 @@ lst$score <- c(90, 66, 88)
```r
成员 <- data.frame(name = c('张梅', '王欣', '王飞'), age = c(60, 34, 6), height = c(158, 173, 118))
成员

cy <- list(name = c('张梅', '王欣', '王飞'), age = c(60, 34, 6), height = c(158, 173, 118))
成员 <- as.data.frame(cy)
成员

X <- array(1:6, c(2, 3))
data.frame(X)
# 数据框的引用
Expand All @@ -302,6 +300,7 @@ attach(成员)
r <- height / age
r
```

- 数据框的编辑
```r
xnew <- edit(xold)
Expand Down Expand Up @@ -422,7 +421,7 @@ u[1:i]
![image](https://github.com/user-attachments/assets/958de7d8-90f5-4823-8388-e4be420a7f7e)

### 例2.5.3求1到100中被3整除余1的数和s1,被3整除余2的数和s2,被3整除的数和 s3。
```{r}
```r
s1 = 0
s2 = 0
s3 = 0
Expand All @@ -437,7 +436,7 @@ print(c(s1, s2, s3))
## 函数

### 例2.5.4 按照定义编写求, 以内的素数。
```{r}
```r
ss <- function(n) {
z = 2
for (i in 2:n) {
Expand Down

0 comments on commit 03b67f4

Please sign in to comment.