From cfd7686a2424278e4a700c81fd7d656aa8c93e9e Mon Sep 17 00:00:00 2001 From: ming Date: Thu, 28 Mar 2024 12:25:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=AC=AC8=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../第8次课后作业_模板.qmd | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/SD/20240328_9_课后作业/第8次课后作业_模板.qmd b/SD/20240328_9_课后作业/第8次课后作业_模板.qmd index b7925dd..0c79e4e 100644 --- a/SD/20240328_9_课后作业/第8次课后作业_模板.qmd +++ b/SD/20240328_9_课后作业/第8次课后作业_模板.qmd @@ -4,22 +4,21 @@ author: 姓名 format: html --- - -# 示例问题,在R中输出`1+2+3+...+100`的结果 - -采用`for`循环完成,代码如下: +# 下载airquality.xlsx,并读取数据 ```{r} -total <- 0 -for (i in 1:100) { - total <- total + i -} -total +# 下载至临时文件 +tmpxlsxpath <- file.path(tempdir(), "airquality.xlsx") +download.file("https://drwater.rcees.ac.cn/git/course/RWEP/raw/branch/PUB/data/airquality.xlsx", + destfile = tmpxlsxpath) +airqualitydf <- readxl::read_xlsx(tmpxlsxpath, sheet = 1) +metadf <- readxl::read_xlsx(tmpxlsxpath, sheet = 2) ``` - # 根据`airqualitydf.xlsx`,按采样点统计白天(8:00-20:00)与夜晚(20:00-8:00)中空气质量指数(AQI)中位数,按城市统计低于所有采样点AQI30%分位值的采样点占比,列出上述占比最高的10个城市(不考虑采样点数低于5个的城市)。 + + # 按照不同城市分组,统计白天与夜晚AQI中位数是否具有显著差异。