Skip to content

Commit

Permalink
Filtrerer også på != 9
Browse files Browse the repository at this point in the history
  • Loading branch information
manjan5 committed Nov 26, 2024
1 parent 5bbfc17 commit 8cf2be9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
39 changes: 25 additions & 14 deletions inst/LokalIndikatorMaaned.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -662,23 +662,34 @@ if (dim(dat)[1] < 1) {
kvalitetsindikatoren."
} else {
#Verdier som skal vises i tabell for denne indikatoren
ant <- sum(dat$AkseptabelSmerte21 == 1, na.rm = TRUE)
totant <- sum(!is.na(dat$AkseptabelSmerte21))
and <- ant/totant
#Før, for sammenligning men ikke indikator
antfoer <- sum(dat$AkseptabelSmerte12 == 1, na.rm = TRUE)
aksept <- dat %>%
dplyr::filter(!is.na(AkseptabelSmerte21), AkseptabelSmerte21 != 9) %>%
dplyr::group_by(AkseptabelSmerte21) %>%
dplyr::summarise(n = dplyr::n()) %>%
dplyr::mutate( ant = sum(n), freq = n/sum(n)) %>%
dplyr::filter(AkseptabelSmerte21 == 1)
totantfoer <- sum(!is.na(dat$AkseptabelSmerte12))
#Tar bort kolonne
aksept <- aksept %>%
dplyr::select(n, ant, freq)
andfoer <- antfoer/totantfoer
# #Verdier som skal vises i tabell for denne indikatoren
# ant <- sum(dat$AkseptabelSmerte21 == 1, na.rm = TRUE)
#
# totant <- sum(!is.na(dat$AkseptabelSmerte21))
#
# and <- ant/totant
#
# #Før, for sammenligning men ikke indikator
# antfoer <- sum(dat$AkseptabelSmerte12 == 1, na.rm = TRUE)
#
# totantfoer <- sum(!is.na(dat$AkseptabelSmerte12))
#
# andfoer <- antfoer/totantfoer
# #
# #Tabell for siste tilsyn
# tabaks <- cbind(ant, totant, and)
#
#Tabell for siste tilsyn
tabaks <- cbind(ant, totant, and)
rapbase::mst(
tab = tabaks,
col_names = c("Antall", "Totalt antall", "Andel"),
Expand Down
10 changes: 5 additions & 5 deletions inst/NasjonalIndikatorMaaned.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -909,21 +909,21 @@ if (dim(dat)[1] < 1) {
kvalitetsindikatoren."
} else {
#VidereOppf, BehNedtrappAvsluttTils og Journalnotat
nedtr <- dat %>%
dplyr::filter(!is.na(AkseptabelSmerte21)) %>%
#
aksept <- dat %>%
dplyr::filter(!is.na(AkseptabelSmerte21), AkseptabelSmerte21 != 9) %>%
dplyr::group_by(SykehusNavn, AkseptabelSmerte21) %>%
dplyr::summarise(n = dplyr::n()) %>%
dplyr::mutate( ant = sum(n), freq = n/sum(n)) %>%
dplyr::filter(AkseptabelSmerte21 == 1)
#Tar bort kolonne
nedtr <- nedtr %>%
aksept <- aksept %>%
dplyr::select(SykehusNavn, n, ant, freq)
#Tabell
rapbase::mst(
tab = nedtr,
tab = aksept,
col_names = c("Sykehus", "Antall", "Totalt antall", "Andel"),
type = params$tableFormat,
cap = paste0("Oversikt over andel med akseptabel smerte ved siste tilsyn."),
Expand Down

0 comments on commit 8cf2be9

Please sign in to comment.