Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ce089
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Walmes Marques Zeviani
ce089
Commits
b68ccc51
Commit
b68ccc51
authored
6 years ago
by
Walmes Marques Zeviani
Browse files
Options
Downloads
Patches
Plain Diff
Melhora a exibição das notas.
parent
5093b060
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
notas.Rmd
+47
-30
47 additions, 30 deletions
notas.Rmd
with
47 additions
and
30 deletions
notas.Rmd
+
47
−
30
View file @
b68ccc51
...
@@ -10,23 +10,24 @@ output:
...
@@ -10,23 +10,24 @@ output:
# Pacotes.
# Pacotes.
rm(list = objects())
rm(list = objects())
library(gdata)
#
library(gdata)
library(tidyverse)
library(tidyverse)
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# Matrícula.
# Matrícula.
path <- "/home/walmes/Dropbox/Ensino/ce089-2018-02/"
path <- "/home/walmes/Dropbox/Ensino/ce089-2018-02/"
x <- read.xls(paste0(path, "RelatoriodeDiariodeClasseExcel.xls"),
x <- gdata::read.xls(paste0(path, "RelatoriodeDiariodeClasseExcel.xls"),
encoding = "latin1",
encoding = "latin1",
stringsAsFactors = FALSE,
stringsAsFactors = FALSE,
skip = 6)
skip = 6)
v <- names(x) %in% c("Matrícula", "Nome", "Faltas")
mat <- x %>%
mat <- x %>%
select(
c("Matrícula", "Nome")
) %>%
select(
names(x)[v]
) %>%
filter(grepl("\\d$", Matrícula)) %>%
filter(grepl("\\d$", Matrícula)) %>%
as_tibble() %>%
as_tibble() %>%
setNames(c("GRR", "nome")
) %>%
rename("GRR" = "Matrícula", "nome" = "Nome"
) %>%
mutate(GRR = str_replace(GRR, "\\D+", "") %>% as.integer())
mutate(GRR = str_replace(GRR, "\\D+", "") %>% as.integer())
str(mat)
str(mat)
...
@@ -42,7 +43,7 @@ str(nt)
...
@@ -42,7 +43,7 @@ str(nt)
# Seleção de variáveis.
# Seleção de variáveis.
nt <- nt %>%
nt <- nt %>%
select(`Data e hora`:`Nota revisada`)
select(`Data e hora`:`Nota revisada`)
str(nt
, give.attr = FALSE
)
str(nt)
# Renomeia variáveis.
# Renomeia variáveis.
names(nt) <- c("ts", "nome", "email", "item", "orig", "revis")
names(nt) <- c("ts", "nome", "email", "item", "orig", "revis")
...
@@ -51,9 +52,9 @@ names(nt) <- c("ts", "nome", "email", "item", "orig", "revis")
...
@@ -51,9 +52,9 @@ names(nt) <- c("ts", "nome", "email", "item", "orig", "revis")
nt <- nt %>%
nt <- nt %>%
filter(grepl("^Sabatina", item),
filter(grepl("^Sabatina", item),
!grepl("walmes", nome, ignore.case = TRUE))
!grepl("walmes", nome, ignore.case = TRUE))
str(nt
, give.attr = FALSE
)
str(nt)
# Cria a estampa de tempo para ordenação.
# Cria a estampa de tempo para ordenação
cronológica dos registros
.
ts_fmt <- "%A, %d %b %Y, %H:%M"
ts_fmt <- "%A, %d %b %Y, %H:%M"
nt$ts <- as.POSIXct(nt$ts, format = ts_fmt)
nt$ts <- as.POSIXct(nt$ts, format = ts_fmt)
...
@@ -61,20 +62,20 @@ nt$ts <- as.POSIXct(nt$ts, format = ts_fmt)
...
@@ -61,20 +62,20 @@ nt$ts <- as.POSIXct(nt$ts, format = ts_fmt)
nt <- nt %>%
nt <- nt %>%
arrange(nome, item, ts)
arrange(nome, item, ts)
# Agrupa pegando o último registro por
avaliação
.
# Agrupa pegando o último registro por
sabatina
.
ntg <- nt %>%
ntg <- nt %>%
group_by(nome, item) %>%
group_by(nome, item) %>%
summarise(nota = last(revis)) %>%
summarise(nota = last(revis)) %>%
ungroup()
ungroup()
str(ntg)
str(ntg)
# Para verificar a
escala de variação
das notas.
# Para verificar a
amplitude de escala
das notas.
# ntg %>%
# ntg %>%
# group_by(item) %>%
# group_by(item) %>%
# summarise(min = min(nota, na.rm = TRUE),
# summarise(min = min(nota, na.rm = TRUE),
# max = max(nota, na.rm = TRUE))
# max = max(nota, na.rm = TRUE))
#
Cria a variável indentificadora da sabatina ao separar text
o.
#
Quebra texto em duas variáveis para ter sabatina e questã
o.
ntg <- ntg %>%
ntg <- ntg %>%
separate(col = "item",
separate(col = "item",
into = c("S", "Q"),
into = c("S", "Q"),
...
@@ -82,7 +83,7 @@ ntg <- ntg %>%
...
@@ -82,7 +83,7 @@ ntg <- ntg %>%
str(ntg)
str(ntg)
# Passa notas para escala 0 - 100.
# Passa notas para escala 0 - 100.
ntg$nota <-
ifelse(ntg$S == "Sabatina 10", yes = 100, no = 10) *
ntg$nota
ntg$nota <- ntg$nota
* 10
# Calcula a média por sabatina e converte NA/NaN para 0.
# Calcula a média por sabatina e converte NA/NaN para 0.
ntg <- ntg %>%
ntg <- ntg %>%
...
@@ -159,20 +160,14 @@ nts <- nts %>%
...
@@ -159,20 +160,14 @@ nts <- nts %>%
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# Tabela em HTML.
# Tabela em HTML.
# nt$Nome <- paste(
# sub(pattern = "^(\\w+) .*$",
# replacement = "\\1",
# x = nt$Nome),
# sub(pattern = "^\\w.* (\\w+)$",
# replacement = "\\1",
# x = nt$Nome))
library(DT)
library(DT)
cap <-
cap <- "Notas nas avaliações (S: sabatina) ordenadas pelo GRR. Valores entre 0 e 100."
"Notas nas avaliações (S: sabatina) ordenadas pelo GRR. Valores entre 0 e 100.*"
if (require(htmltools)) {
cap <- HTML("<strong>Tabela 1</strong>:", cap)
}
dt <- datatable(data = select(nts, "GRR", contains("S")),
dt <- datatable(data = select(nts, "GRR", contains("S")
, contains("Faltas")
),
filter = "top",
filter = "top",
caption = cap,
caption = cap,
rownames = FALSE,
rownames = FALSE,
...
@@ -183,7 +178,6 @@ dt <- datatable(data = select(nts, "GRR", contains("S")),
...
@@ -183,7 +178,6 @@ dt <- datatable(data = select(nts, "GRR", contains("S")),
paging = FALSE,
paging = FALSE,
pageLength = NULL,
pageLength = NULL,
lengthMenu = NULL))
lengthMenu = NULL))
# str(dt$x$data)
dt <- formatStyle(table = dt,
dt <- formatStyle(table = dt,
columns = grepl("^S", names(dt$x$data)),
columns = grepl("^S", names(dt$x$data)),
...
@@ -193,6 +187,14 @@ dt <- formatStyle(table = dt,
...
@@ -193,6 +187,14 @@ dt <- formatStyle(table = dt,
"gray",
"gray",
"#3333ff")))
"#3333ff")))
if (is.element("Faltas", names(dt$x$data))) {
dt <- formatStyle(table = dt,
columns = "Faltas",
color = styleInterval(cuts = c(15),
values = c("#3333ff",
"#ff3300")))
}
dt
dt
```
```
...
@@ -200,7 +202,7 @@ dt
...
@@ -200,7 +202,7 @@ dt
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# Visualização.
# Visualização.
cap <- "Escore final das sabatinas em função do GRR. Cores indicam grupos conforme corte do escore classes."
cap <- "
**Figura 1**:
Escore final das sabatinas em função do GRR. Cores indicam grupos conforme corte do escore classes."
# # Acumulada empírica.
# # Acumulada empírica.
# ggplot(nts, aes(x = S_escore)) +
# ggplot(nts, aes(x = S_escore)) +
...
@@ -226,7 +228,22 @@ ggplot(data = nts,
...
@@ -226,7 +228,22 @@ ggplot(data = nts,
xlim(0, 100)
xlim(0, 100)
```
```
```{r, eval = FALSE, echo = FALSE, results = "hide", fig.cap = cap}
```{r, echo = FALSE, fig.cap = cap, message = FALSE, warning = FALSE, results = "hide"}
ggplot(data = nts,
mapping = aes(y = S_escore,
x = Faltas)) +
geom_jitter(height = 0, width = 0.5) +
geom_smooth(se = FALSE, span = 0.8, color = "gray50")
# Correlação de Spearman.
x <- with(nts, cor.test(x = S_escore, y = Faltas, method = "spearman"))
x$p.value
cap <- "**Figura 2**: Diagrama de dispersão relacionando o escore final nas sabatinas e o número de faltas (Spearman, rho = %0.2f, valor p = %0.3g)."
cap <- sprintf(cap, x$estimate, x$p.value)
```
```{r, echo = FALSE, results = "hide", fig.cap = cap}
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# Análise multivariada das notas.
# Análise multivariada das notas.
...
@@ -249,7 +266,7 @@ pca$loadings
...
@@ -249,7 +266,7 @@ pca$loadings
#--------------------------------------------
#--------------------------------------------
# Agrupamento hierárquico.
# Agrupamento hierárquico.
cap <- "Agrupamento hierárquico dos GRR baseado nas distâncias entre os vetores de notas das sabatinas."
cap <- "
**Figura 3**:
Agrupamento hierárquico dos GRR baseado nas distâncias entre os vetores de notas das sabatinas."
d <- dist(X)
d <- dist(X)
hc <- hclust(d = d)
hc <- hclust(d = d)
...
@@ -264,7 +281,7 @@ plot(hc,
...
@@ -264,7 +281,7 @@ plot(hc,
```
```
```{r, eval = FALSE, echo = FALSE, results = "asis"}
```{r, eval = FALSE, echo = FALSE, results = "asis"}
x <- knitr::kable(
subset(nt, select = v)
,
x <- knitr::kable(
nt
,
caption = cap,
caption = cap,
row.names = FALSE,
row.names = FALSE,
na.string = "",
na.string = "",
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment