2024-03-25 21:48:30 +08:00
|
|
|
|
---
|
2024-03-28 08:15:02 +08:00
|
|
|
|
title: 课后作业8
|
2024-03-25 21:48:30 +08:00
|
|
|
|
author: 姓名
|
|
|
|
|
format: html
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 示例问题,在R中输出`1+2+3+...+100`的结果
|
|
|
|
|
|
|
|
|
|
采用`for`循环完成,代码如下:
|
|
|
|
|
|
|
|
|
|
```{r}
|
|
|
|
|
total <- 0
|
|
|
|
|
for (i in 1:100) {
|
|
|
|
|
total <- total + i
|
|
|
|
|
}
|
|
|
|
|
total
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2024-03-26 16:58:06 +08:00
|
|
|
|
# 根据`airqualitydf.xlsx`,按采样点统计白天(8:00-20:00)与夜晚(20:00-8:00)中空气质量指数(AQI)中位数,按城市统计低于所有采样点AQI30%分位值的采样点占比,列出上述占比最高的10个城市(不考虑采样点数低于5个的城市)。
|
2024-03-25 21:48:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-26 16:58:06 +08:00
|
|
|
|
# 按照不同城市分组,统计白天与夜晚AQI中位数是否具有显著差异。
|