Navigation>My courses>YOUR LECTURE>Grades
Choose “Plain text file” in the box under your User picture.
Click on “Download” on the bottom of the page.
# import libraries
library(tidyverse)
library(janitor) # 列名をきれいにする
# load the data
df0 <- read_csv("data/comEmg2_2.csv")
# import libraries
library(tidyverse)
library(janitor) # 列名をきれいにする
# load the data
df0 <- read_csv("data/comEmg2_2.csv")
df0 %>%
clean_names() %>% # 列名をきれいにして、
select(id_number, 11:24) %>% # 列を選択して、
slice(-8) %>% # 不要な行を削除して、
mutate_all(funs(str_replace(., "-", "NA"))) %>% # -をNAにかえて、
type_convert() %>% # 文字を数値にかえて、
pivot_longer(-id_number, # よこ長データをたて長にして、
names_to = "lecture", # 新たな列名をlectureして
names_prefix = "assignment_noto_ti_chu", # 列名のから除いて、
values_to = "score") -> df1 # 値列の列名をscoreに
df1
## # A tibble: 980 x 3
## id_number lecture score
## <chr> <chr> <dbl>
## 1 g3220069 1_10dian_real 10
## 2 g3220069 2_10dian_real 10
## 3 g3220069 3_10dian_real 10
## 4 g3220069 4_10dian_real 10
## 5 g3220069 5_10dian_real 10
## 6 g3220069 6_10dian_real 10
## 7 g3220069 7_10dian_real 10
## 8 g3220069 8_10dian_real 10
## 9 g3220069 9_10dian_real 10
## 10 g3220069 10_10dian_real 10
## # … with 970 more rows
df1 %>% # df1の
group_by(lecture) %>% # lecture列でグループ分けし、
replace_na(list(score = 0)) %>% # NAを0にかえて、
summarize(mean = round(mean(score),2)*10) -> df2 # 各回の出席率を集計
df2
## # A tibble: 14 x 2
## lecture mean
## <chr> <dbl>
## 1 1_10dian_real 82.9
## 2 10_10dian_real 71.4
## 3 11_10dian_real 74.3
## 4 12_10dian_real 74.3
## 5 13_10dian_real 74.3
## 6 14_10dian_real 74.3
## 7 2_10dian_real 82.9
## 8 3_10dian_real 78.6
## 9 4_10dian_real 75.7
## 10 5_10dian_real 81.4
## 11 6_10dian_real 80
## 12 7_10dian_real 78.6
## 13 8_10dian_real 75.7
## 14 9_10dian_real 74.3
# create a bar chart with values inside bars
ggplot(df2, aes(x=lecture, y=mean)) +
geom_bar(stat="identity", fill="steelblue")+
geom_text(aes(label=mean), vjust=1.6, color="white", size=3.5)+
theme_minimal() +
labs(
x = "提出回",
y = "提出割合",
title = "コンピュータ英語II(水2)のノート2−14の提出率") +
theme_gray (base_family = "HiraKakuPro-W3") # 日本語を表示